Example usage for java.awt BorderLayout WEST

List of usage examples for java.awt BorderLayout WEST

Introduction

In this page you can find the example usage for java.awt BorderLayout WEST.

Prototype

String WEST

To view the source code for java.awt BorderLayout WEST.

Click Source Link

Document

The west layout constraint (left side of container).

Usage

From source file:net.sourceforge.pmd.cpd.GUI.java

private JPanel makeResultsPanel() {
    JPanel resultsPanel = new JPanel();
    resultsPanel.setLayout(new BorderLayout());
    JScrollPane areaScrollPane = new JScrollPane(resultsTextArea);
    resultsTextArea.setEditable(false);//from   www. ja v  a 2  s.c om
    areaScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    areaScrollPane.setPreferredSize(new Dimension(600, 300));

    resultsPanel.add(makeMatchList(), BorderLayout.WEST);
    resultsPanel.add(areaScrollPane, BorderLayout.CENTER);
    return resultsPanel;
}

From source file:ch.bfh.lca._15h.server.gui.MainWindowServer.java

private void drawTable(List<GenericResultRow> lines) {

    Object[][] rows = new Object[lines.size()][3];
    Object[] header = { "Alter", "Mnner", "Frauen" };
    int i = 0;//from  w w w  .java  2 s.  c o m
    for (GenericResultRow grr : lines) {
        rows[i][0] = grr.getValueAt(0);
        rows[i][1] = grr.getValueAt(1);
        rows[i][2] = grr.getValueAt(2);
        i++;
    }

    JTable table = new JTable(rows, header);

    this.pnlMain.removeAll();
    this.pnlMain.setLayout(new java.awt.BorderLayout());
    this.pnlMain.add(new JScrollPane(table), BorderLayout.WEST);
    this.pnlMain.validate();
    this.pnlMain.repaint();

}

From source file:shuffle.fwk.service.teams.EditTeamService.java

@SuppressWarnings("serial")
private Component makeTeamPanel() {

    JPanel firstOptionRow = new JPanel(new GridBagLayout());
    GridBagConstraints rowc = new GridBagConstraints();
    rowc.fill = GridBagConstraints.HORIZONTAL;
    rowc.weightx = 0.0;/*from   www . j a  va  2 s. c om*/
    rowc.weighty = 0.0;

    rowc.weightx = 1.0;
    rowc.gridx = 1;
    stageChooser = new StageChooser(this);
    firstOptionRow.add(stageChooser, rowc);
    rowc.weightx = 0.0;

    JPanel secondOptionRow = new JPanel(new GridBagLayout());

    rowc.gridx = 1;
    JLabel megaLabel = new JLabel(getString(KEY_MEGA_LABEL));
    megaLabel.setToolTipText(getString(KEY_MEGA_TOOLTIP));
    secondOptionRow.add(megaLabel, rowc);

    rowc.gridx = 2;
    megaChooser = new JComboBox<String>();
    megaChooser.setToolTipText(getString(KEY_MEGA_TOOLTIP));
    secondOptionRow.add(megaChooser, rowc);

    rowc.gridx = 3;
    JPanel progressPanel = new JPanel(new BorderLayout());
    megaActive = new JCheckBox(getString(KEY_ACTIVE));
    megaActive.setSelected(false);
    megaActive.setToolTipText(getString(KEY_ACTIVE_TOOLTIP));
    progressPanel.add(megaActive, BorderLayout.WEST);
    megaProgressChooser = new JComboBox<Integer>();
    progressPanel.add(megaProgressChooser, BorderLayout.EAST);
    megaProgressChooser.setToolTipText(getString(KEY_MEGA_PROGRESS_TOOLTIP));
    secondOptionRow.add(progressPanel, rowc);

    JPanel thirdOptionRow = new JPanel(new GridBagLayout());

    rowc.gridx = 1;
    JButton clearTeamButton = new JButton(getString(KEY_CLEAR_TEAM));
    clearTeamButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            clearTeam();
        }
    });
    clearTeamButton.setToolTipText(getString(KEY_CLEAR_TEAM_TOOLTIP));
    thirdOptionRow.add(clearTeamButton, rowc);

    rowc.gridx = 2;
    woodCheckBox = new JCheckBox(getString(KEY_WOOD));
    woodCheckBox.setToolTipText(getString(KEY_WOOD_TOOLTIP));
    thirdOptionRow.add(woodCheckBox, rowc);

    rowc.gridx = 3;
    metalCheckBox = new JCheckBox(getString(KEY_METAL));
    metalCheckBox.setToolTipText(getString(KEY_METAL_TOOLTIP));
    thirdOptionRow.add(metalCheckBox, rowc);

    rowc.gridx = 4;
    coinCheckBox = new JCheckBox(getString(KEY_COIN));
    coinCheckBox.setToolTipText(getString(KEY_COIN_TOOLTIP));
    thirdOptionRow.add(coinCheckBox, rowc);

    rowc.gridx = 5;
    freezeCheckBox = new JCheckBox(getString(KEY_FREEZE));
    freezeCheckBox.setToolTipText(getString(KEY_FREEZE_TOOLTIP));
    thirdOptionRow.add(freezeCheckBox, rowc);

    JPanel topPart = new JPanel(new GridBagLayout());
    GridBagConstraints topC = new GridBagConstraints();
    topC.fill = GridBagConstraints.HORIZONTAL;
    topC.weightx = 0.0;
    topC.weighty = 0.0;
    topC.gridx = 1;
    topC.gridy = 1;
    topC.gridwidth = 1;
    topC.gridheight = 1;
    topC.anchor = GridBagConstraints.CENTER;

    topC.gridy = 1;
    topPart.add(firstOptionRow, topC);
    topC.gridy = 2;
    topPart.add(secondOptionRow, topC);
    topC.gridy = 3;
    topPart.add(thirdOptionRow, topC);

    addOptionListeners();

    teamPanel = new JPanel(new WrapLayout()) {
        // Fix to make it play nice with the scroll bar.
        @Override
        public Dimension getPreferredSize() {
            Dimension d = super.getPreferredSize();
            d.width = (int) (d.getWidth() - 20);
            return d;
        }
    };
    final JScrollPane scrollPane = new JScrollPane(teamPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER) {
        @Override
        public Dimension getMinimumSize() {
            Dimension d = super.getMinimumSize();
            d.width = topPart.getMinimumSize().width;
            d.height = rosterScrollPane.getPreferredSize().height - topPart.getPreferredSize().height;
            return d;
        }

        @Override
        public Dimension getPreferredSize() {
            Dimension d = super.getPreferredSize();
            d.width = topPart.getMinimumSize().width;
            d.height = rosterScrollPane.getPreferredSize().height - topPart.getPreferredSize().height;
            return d;
        }
    };
    scrollPane.addComponentListener(new ComponentAdapter() {
        @Override
        public void componentResized(ComponentEvent e) {
            scrollPane.revalidate();
        }
    });
    scrollPane.getVerticalScrollBar().setUnitIncrement(27);

    JPanel ret = new JPanel(new GridBagLayout());
    GridBagConstraints rc = new GridBagConstraints();
    rc.fill = GridBagConstraints.VERTICAL;
    rc.weightx = 0.0;
    rc.weighty = 0.0;
    rc.gridx = 1;
    rc.gridy = 1;
    rc.insets = new Insets(5, 5, 5, 5);
    ret.add(topPart, rc);
    rc.gridy += 1;
    rc.weightx = 0.0;
    rc.weighty = 1.0;
    rc.insets = new Insets(0, 0, 0, 0);
    ret.add(scrollPane, rc);
    return ret;
}

From source file:org.jtrfp.trcl.gui.ConfigWindow.java

public ConfigWindow() {
    setTitle("Settings");
    setSize(340, 540);//from  w w w .j a  v  a  2 s  . c  o m
    if (config == null)
        config = new TRConfiguration();
    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    getContentPane().add(tabbedPane, BorderLayout.CENTER);

    JPanel generalTab = new JPanel();
    tabbedPane.addTab("General",
            new ImageIcon(ConfigWindow.class
                    .getResource("/org/freedesktop/tango/22x22/mimetypes/application-x-executable.png")),
            generalTab, null);
    GridBagLayout gbl_generalTab = new GridBagLayout();
    gbl_generalTab.columnWidths = new int[] { 0, 0 };
    gbl_generalTab.rowHeights = new int[] { 0, 188, 222, 0 };
    gbl_generalTab.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
    gbl_generalTab.rowWeights = new double[] { 0.0, 1.0, 0.0, Double.MIN_VALUE };
    generalTab.setLayout(gbl_generalTab);

    JPanel settingsLoadSavePanel = new JPanel();
    GridBagConstraints gbc_settingsLoadSavePanel = new GridBagConstraints();
    gbc_settingsLoadSavePanel.insets = new Insets(0, 0, 5, 0);
    gbc_settingsLoadSavePanel.anchor = GridBagConstraints.WEST;
    gbc_settingsLoadSavePanel.gridx = 0;
    gbc_settingsLoadSavePanel.gridy = 0;
    generalTab.add(settingsLoadSavePanel, gbc_settingsLoadSavePanel);
    settingsLoadSavePanel.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null),
            "Overall Settings", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    FlowLayout flowLayout_1 = (FlowLayout) settingsLoadSavePanel.getLayout();
    flowLayout_1.setAlignment(FlowLayout.LEFT);

    JButton btnSave = new JButton("Export...");
    btnSave.setToolTipText("Export these settings to an external file");
    settingsLoadSavePanel.add(btnSave);
    btnSave.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            exportSettings();
        }
    });

    JButton btnLoad = new JButton("Import...");
    btnLoad.setToolTipText("Import an external settings file");
    settingsLoadSavePanel.add(btnLoad);
    btnLoad.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            importSettings();
        }
    });

    JButton btnConfigReset = new JButton("Reset");
    btnConfigReset.setToolTipText("Reset all settings to defaults");
    settingsLoadSavePanel.add(btnConfigReset);
    btnConfigReset.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            defaultSettings();
        }
    });

    JPanel registeredPODsPanel = new JPanel();
    registeredPODsPanel.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null),
            "Registered PODs", TitledBorder.LEFT, TitledBorder.TOP, null, null));
    GridBagConstraints gbc_registeredPODsPanel = new GridBagConstraints();
    gbc_registeredPODsPanel.insets = new Insets(0, 0, 5, 0);
    gbc_registeredPODsPanel.fill = GridBagConstraints.BOTH;
    gbc_registeredPODsPanel.gridx = 0;
    gbc_registeredPODsPanel.gridy = 1;
    generalTab.add(registeredPODsPanel, gbc_registeredPODsPanel);
    GridBagLayout gbl_registeredPODsPanel = new GridBagLayout();
    gbl_registeredPODsPanel.columnWidths = new int[] { 272, 0 };
    gbl_registeredPODsPanel.rowHeights = new int[] { 76, 0, 0 };
    gbl_registeredPODsPanel.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
    gbl_registeredPODsPanel.rowWeights = new double[] { 1.0, 1.0, Double.MIN_VALUE };
    registeredPODsPanel.setLayout(gbl_registeredPODsPanel);

    JPanel podListPanel = new JPanel();
    GridBagConstraints gbc_podListPanel = new GridBagConstraints();
    gbc_podListPanel.insets = new Insets(0, 0, 5, 0);
    gbc_podListPanel.fill = GridBagConstraints.BOTH;
    gbc_podListPanel.gridx = 0;
    gbc_podListPanel.gridy = 0;
    registeredPODsPanel.add(podListPanel, gbc_podListPanel);
    podListPanel.setLayout(new BorderLayout(0, 0));

    JScrollPane podListScrollPane = new JScrollPane();
    podListPanel.add(podListScrollPane, BorderLayout.CENTER);

    podList = new JList(podLM);
    podList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    podListScrollPane.setViewportView(podList);

    JPanel podListOpButtonPanel = new JPanel();
    podListOpButtonPanel.setBorder(null);
    GridBagConstraints gbc_podListOpButtonPanel = new GridBagConstraints();
    gbc_podListOpButtonPanel.anchor = GridBagConstraints.NORTH;
    gbc_podListOpButtonPanel.gridx = 0;
    gbc_podListOpButtonPanel.gridy = 1;
    registeredPODsPanel.add(podListOpButtonPanel, gbc_podListOpButtonPanel);
    FlowLayout flowLayout = (FlowLayout) podListOpButtonPanel.getLayout();
    flowLayout.setAlignment(FlowLayout.LEFT);

    JButton addPodButton = new JButton("Add...");
    addPodButton.setIcon(
            new ImageIcon(ConfigWindow.class.getResource("/org/freedesktop/tango/16x16/actions/list-add.png")));
    addPodButton.setToolTipText("Add a POD to the registry to be considered when running a game.");
    podListOpButtonPanel.add(addPodButton);
    addPodButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            addPOD();
        }
    });

    JButton removePodButton = new JButton("Remove");
    removePodButton.setIcon(new ImageIcon(
            ConfigWindow.class.getResource("/org/freedesktop/tango/16x16/actions/list-remove.png")));
    removePodButton.setToolTipText("Remove a POD file from being considered when playing a game");
    podListOpButtonPanel.add(removePodButton);
    removePodButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            podLM.removeElement(podList.getSelectedValue());
        }
    });

    JButton podEditButton = new JButton("Edit...");
    podEditButton.setIcon(null);
    podEditButton.setToolTipText("Edit the selected POD path");
    podListOpButtonPanel.add(podEditButton);
    podEditButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            editPODPath();
        }
    });

    JPanel missionPanel = new JPanel();
    GridBagConstraints gbc_missionPanel = new GridBagConstraints();
    gbc_missionPanel.fill = GridBagConstraints.BOTH;
    gbc_missionPanel.gridx = 0;
    gbc_missionPanel.gridy = 2;
    generalTab.add(missionPanel, gbc_missionPanel);
    missionPanel.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null), "Missions",
            TitledBorder.LEADING, TitledBorder.TOP, null, null));
    GridBagLayout gbl_missionPanel = new GridBagLayout();
    gbl_missionPanel.columnWidths = new int[] { 0, 0 };
    gbl_missionPanel.rowHeights = new int[] { 0, 0, 0 };
    gbl_missionPanel.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
    gbl_missionPanel.rowWeights = new double[] { 1.0, 0.0, Double.MIN_VALUE };
    missionPanel.setLayout(gbl_missionPanel);

    JScrollPane scrollPane = new JScrollPane();
    GridBagConstraints gbc_scrollPane = new GridBagConstraints();
    gbc_scrollPane.insets = new Insets(0, 0, 5, 0);
    gbc_scrollPane.fill = GridBagConstraints.BOTH;
    gbc_scrollPane.gridx = 0;
    gbc_scrollPane.gridy = 0;
    missionPanel.add(scrollPane, gbc_scrollPane);

    missionList = new JList(missionLM);
    missionList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    scrollPane.setViewportView(missionList);

    JPanel missionListOpButtonPanel = new JPanel();
    GridBagConstraints gbc_missionListOpButtonPanel = new GridBagConstraints();
    gbc_missionListOpButtonPanel.anchor = GridBagConstraints.NORTH;
    gbc_missionListOpButtonPanel.gridx = 0;
    gbc_missionListOpButtonPanel.gridy = 1;
    missionPanel.add(missionListOpButtonPanel, gbc_missionListOpButtonPanel);

    JButton addVOXButton = new JButton("Add...");
    addVOXButton.setIcon(
            new ImageIcon(ConfigWindow.class.getResource("/org/freedesktop/tango/16x16/actions/list-add.png")));
    addVOXButton.setToolTipText("Add an external VOX file as a mission");
    missionListOpButtonPanel.add(addVOXButton);
    addVOXButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            addVOX();
        }
    });

    final JButton removeVOXButton = new JButton("Remove");
    removeVOXButton.setIcon(new ImageIcon(
            ConfigWindow.class.getResource("/org/freedesktop/tango/16x16/actions/list-remove.png")));
    removeVOXButton.setToolTipText("Remove the selected mission");
    missionListOpButtonPanel.add(removeVOXButton);
    removeVOXButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            missionLM.remove(missionList.getSelectedIndex());
        }
    });

    final JButton editVOXButton = new JButton("Edit...");
    editVOXButton.setToolTipText("Edit the selected Mission's VOX path");
    missionListOpButtonPanel.add(editVOXButton);
    editVOXButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            editVOXPath();
        }
    });

    missionList.addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent evt) {
            final String val = (String) missionList.getSelectedValue();
            if (val == null)
                missionList.setSelectedIndex(0);
            else if (isBuiltinVOX(val)) {
                removeVOXButton.setEnabled(false);
                editVOXButton.setEnabled(false);
            } else {
                removeVOXButton.setEnabled(true);
                editVOXButton.setEnabled(true);
            }
        }
    });

    JPanel soundTab = new JPanel();
    tabbedPane.addTab("Sound",
            new ImageIcon(
                    ConfigWindow.class.getResource("/org/freedesktop/tango/22x22/devices/audio-card.png")),
            soundTab, null);
    GridBagLayout gbl_soundTab = new GridBagLayout();
    gbl_soundTab.columnWidths = new int[] { 0, 0 };
    gbl_soundTab.rowHeights = new int[] { 65, 51, 70, 132, 0, 0, 0 };
    gbl_soundTab.columnWeights = new double[] { 1.0, Double.MIN_VALUE };
    gbl_soundTab.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE };
    soundTab.setLayout(gbl_soundTab);

    JPanel checkboxPanel = new JPanel();
    GridBagConstraints gbc_checkboxPanel = new GridBagConstraints();
    gbc_checkboxPanel.insets = new Insets(0, 0, 5, 0);
    gbc_checkboxPanel.fill = GridBagConstraints.BOTH;
    gbc_checkboxPanel.gridx = 0;
    gbc_checkboxPanel.gridy = 0;
    soundTab.add(checkboxPanel, gbc_checkboxPanel);

    chckbxLinearInterpolation = new JCheckBox("Linear Filtering");
    chckbxLinearInterpolation.setToolTipText("Use the GPU's TMU to smooth playback of low-rate samples.");
    chckbxLinearInterpolation.setHorizontalAlignment(SwingConstants.LEFT);
    checkboxPanel.add(chckbxLinearInterpolation);

    chckbxLinearInterpolation.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            needRestart = true;
        }
    });

    chckbxBufferLag = new JCheckBox("Buffer Lag");
    chckbxBufferLag.setToolTipText("Improves efficiency, doubles latency.");
    checkboxPanel.add(chckbxBufferLag);

    JPanel modStereoWidthPanel = new JPanel();
    FlowLayout flowLayout_2 = (FlowLayout) modStereoWidthPanel.getLayout();
    flowLayout_2.setAlignment(FlowLayout.LEFT);
    modStereoWidthPanel.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null),
            "MOD Stereo Width", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    GridBagConstraints gbc_modStereoWidthPanel = new GridBagConstraints();
    gbc_modStereoWidthPanel.anchor = GridBagConstraints.NORTH;
    gbc_modStereoWidthPanel.insets = new Insets(0, 0, 5, 0);
    gbc_modStereoWidthPanel.fill = GridBagConstraints.HORIZONTAL;
    gbc_modStereoWidthPanel.gridx = 0;
    gbc_modStereoWidthPanel.gridy = 1;
    soundTab.add(modStereoWidthPanel, gbc_modStereoWidthPanel);

    modStereoWidthSlider = new JSlider();
    modStereoWidthSlider.setPaintTicks(true);
    modStereoWidthSlider.setMinorTickSpacing(25);
    modStereoWidthPanel.add(modStereoWidthSlider);

    final JLabel modStereoWidthLbl = new JLabel("NN%");
    modStereoWidthPanel.add(modStereoWidthLbl);

    JPanel bufferSizePanel = new JPanel();
    FlowLayout flowLayout_3 = (FlowLayout) bufferSizePanel.getLayout();
    flowLayout_3.setAlignment(FlowLayout.LEFT);
    bufferSizePanel.setBorder(
            new TitledBorder(null, "Buffer Size", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    GridBagConstraints gbc_bufferSizePanel = new GridBagConstraints();
    gbc_bufferSizePanel.anchor = GridBagConstraints.NORTH;
    gbc_bufferSizePanel.insets = new Insets(0, 0, 5, 0);
    gbc_bufferSizePanel.fill = GridBagConstraints.HORIZONTAL;
    gbc_bufferSizePanel.gridx = 0;
    gbc_bufferSizePanel.gridy = 2;
    soundTab.add(bufferSizePanel, gbc_bufferSizePanel);

    audioBufferSizeCB = new JComboBox();
    audioBufferSizeCB.setModel(new DefaultComboBoxModel(AudioBufferSize.values()));
    bufferSizePanel.add(audioBufferSizeCB);

    soundOutputSelectorGUI = new SoundOutputSelectorGUI();
    soundOutputSelectorGUI.setBorder(
            new TitledBorder(null, "Output Driver", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    GridBagConstraints gbc_soundOutputSelectorGUI = new GridBagConstraints();
    gbc_soundOutputSelectorGUI.anchor = GridBagConstraints.NORTH;
    gbc_soundOutputSelectorGUI.insets = new Insets(0, 0, 5, 0);
    gbc_soundOutputSelectorGUI.fill = GridBagConstraints.HORIZONTAL;
    gbc_soundOutputSelectorGUI.gridx = 0;
    gbc_soundOutputSelectorGUI.gridy = 3;
    soundTab.add(soundOutputSelectorGUI, gbc_soundOutputSelectorGUI);

    modStereoWidthSlider.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent arg0) {
            modStereoWidthLbl.setText(modStereoWidthSlider.getValue() + "%");
            needRestart = true;
        }
    });

    JPanel okCancelPanel = new JPanel();
    getContentPane().add(okCancelPanel, BorderLayout.SOUTH);
    okCancelPanel.setLayout(new BorderLayout(0, 0));

    JButton btnOk = new JButton("OK");
    btnOk.setToolTipText("Apply these settings and close the window");
    okCancelPanel.add(btnOk, BorderLayout.WEST);
    btnOk.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            applySettings();
            ConfigWindow.this.setVisible(false);
        }
    });

    JButton btnCancel = new JButton("Cancel");
    btnCancel.setToolTipText("Close the window without applying settings");
    okCancelPanel.add(btnCancel, BorderLayout.EAST);

    JLabel lblConfigpath = new JLabel(TRConfiguration.getConfigFilePath().getAbsolutePath());
    lblConfigpath.setIcon(null);
    lblConfigpath.setToolTipText("Default config file path");
    lblConfigpath.setHorizontalAlignment(SwingConstants.CENTER);
    lblConfigpath.setFont(new Font("Dialog", Font.BOLD, 6));
    okCancelPanel.add(lblConfigpath, BorderLayout.CENTER);
    btnCancel.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            ConfigWindow.this.setVisible(false);
        }
    });
}

From source file:org.apache.jmeter.protocol.http.config.gui.UrlConfigGuiClassifier.java

private JPanel getClassifierPanel() {
    type = new JTextField(20);

    JLabel label = new JLabel("Type"); // $NON-NLS-1$
    label.setLabelFor(type);/*www  .  j  a  v  a2s .  c o m*/

    JPanel panel = new JPanel(new BorderLayout(5, 0));
    panel.add(label, BorderLayout.WEST);
    panel.add(type, BorderLayout.CENTER);
    return panel;
}

From source file:org.apache.jmeter.visualizers.StatGraphVisualizer.java

/**
 * Main visualizer setup.//from   w ww .  j  av a  2s .c  om
 */
private void init() { // WARNING: called from ctor so must not be overridden (i.e. must be private or final)
    this.setLayout(new BorderLayout());

    // MAIN PANEL
    JPanel mainPanel = new JPanel();
    Border margin = new EmptyBorder(10, 10, 5, 10);
    Border margin2 = new EmptyBorder(10, 10, 5, 10);

    mainPanel.setBorder(margin);
    mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
    mainPanel.add(makeTitlePanel());

    myJTable = new JTable(model);
    JMeterUtils.applyHiDPI(myJTable);
    // Fix centering of titles
    myJTable.getTableHeader().setDefaultRenderer(new HeaderAsPropertyRenderer(COLUMNS_MSG_PARAMETERS));
    myJTable.setPreferredScrollableViewportSize(new Dimension(500, 70));
    RendererUtils.applyRenderers(myJTable, RENDERERS);
    myScrollPane = new JScrollPane(myJTable);

    settingsPane = new VerticalPanel();
    settingsPane.setBorder(margin2);

    graphPanel = new AxisGraph();
    graphPanel.setPreferredSize(new Dimension(defaultWidth, defaultHeight));

    settingsPane.add(createGraphActionsPane());
    settingsPane.add(createGraphColumnPane());
    settingsPane.add(createGraphTitlePane());
    settingsPane.add(createGraphDimensionPane());
    JPanel axisPane = new JPanel(new BorderLayout());
    axisPane.add(createGraphXAxisPane(), BorderLayout.WEST);
    axisPane.add(createGraphYAxisPane(), BorderLayout.CENTER);
    settingsPane.add(axisPane);
    settingsPane.add(createLegendPane());

    tabbedGraph.addTab(JMeterUtils.getResString("aggregate_graph_tab_settings"), settingsPane); //$NON-NLS-1$
    tabbedGraph.addTab(JMeterUtils.getResString("aggregate_graph_tab_graph"), graphPanel); //$NON-NLS-1$

    // If clic on the Graph tab, make the graph (without apply interval or filter)
    ChangeListener changeListener = new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent changeEvent) {
            JTabbedPane srcTab = (JTabbedPane) changeEvent.getSource();
            int index = srcTab.getSelectedIndex();
            if (srcTab.getTitleAt(index).equals(JMeterUtils.getResString("aggregate_graph_tab_graph"))) { //$NON-NLS-1$
                actionMakeGraph();
            }
        }
    };
    tabbedGraph.addChangeListener(changeListener);

    spane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    spane.setLeftComponent(myScrollPane);
    spane.setRightComponent(tabbedGraph);
    spane.setResizeWeight(.2);
    spane.setBorder(null); // see bug jdk 4131528
    spane.setContinuousLayout(true);

    this.add(mainPanel, BorderLayout.NORTH);
    this.add(spane, BorderLayout.CENTER);
}

From source file:com.unionpay.upmp.jmeterplugin.gui.UPMPUrlConfigGui.java

private JPanel getProxyPassPanel() {
    proxyPass = new JPasswordField(5);

    JLabel label = new JLabel(JMeterUtils.getResString("password")); // $NON-NLS-1$
    label.setLabelFor(proxyPass);//from  w  w w . ja v  a  2s . c o  m

    JPanel panel = new JPanel(new BorderLayout(5, 0));
    panel.add(label, BorderLayout.WEST);
    panel.add(proxyPass, BorderLayout.CENTER);
    return panel;
}

From source file:org.apache.jmeter.protocol.http.config.gui.UrlConfigGui.java

private JPanel getProxyPortPanel() {
    proxyPort = new JTextField(10);

    JLabel label = new JLabel(JMeterUtils.getResString("web_server_port")); // $NON-NLS-1$
    label.setLabelFor(proxyPort);//from w  w  w .  j  av  a 2  s . c  om
    label.setFont(FONT_SMALL);

    JPanel panel = new JPanel(new BorderLayout(5, 0));
    panel.add(label, BorderLayout.WEST);
    panel.add(proxyPort, BorderLayout.CENTER);

    return panel;
}

From source file:net.sf.firemox.DeckBuilder.java

/**
 * Creates new form DeckBuilder//  ww  w.  j  av a2  s  . c om
 */
private DeckBuilder() {
    super("DeckBuilder");
    form = this;
    timerPanel = new TimerGlassPane();
    cardLoader = new CardLoader(timerPanel);
    timer = new Timer(200, cardLoader);
    setGlassPane(timerPanel);
    try {
        setIconImage(Picture.loadImage(IdConst.IMAGES_DIR + "deckbuilder.gif"));
    } catch (Exception e) {
        // IGNORING
    }

    // Load settings
    loadSettings();

    // Initialize components
    final JMenuItem newItem = UIHelper.buildMenu("menu_db_new", 'n', this);
    newItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, InputEvent.CTRL_MASK));

    final JMenuItem loadItem = UIHelper.buildMenu("menu_db_load", 'o', this);
    loadItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_MASK));

    final JMenuItem saveAsItem = UIHelper.buildMenu("menu_db_saveas", 'a', this);
    saveAsItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F12, 0));

    final JMenuItem saveItem = UIHelper.buildMenu("menu_db_save", 's', this);
    saveItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.CTRL_MASK));

    final JMenuItem quitItem = UIHelper.buildMenu("menu_db_exit", this);
    quitItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F4, InputEvent.ALT_MASK));

    final JMenuItem deckConstraintsItem = UIHelper.buildMenu("menu_db_constraints", 'c', this);
    deckConstraintsItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0));

    final JMenuItem aboutItem = UIHelper.buildMenu("menu_help_about", 'a', this);
    aboutItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, InputEvent.SHIFT_MASK));

    final JMenuItem convertDCK = UIHelper.buildMenu("menu_convert_DCK_MP", this);

    final JMenu mainMenu = UIHelper.buildMenu("menu_file");
    mainMenu.add(newItem);
    mainMenu.add(loadItem);
    mainMenu.add(saveAsItem);
    mainMenu.add(saveItem);
    mainMenu.add(new JSeparator());
    mainMenu.add(quitItem);

    super.optionMenu = new JMenu("Options");

    final JMenu convertMenu = UIHelper.buildMenu("menu_convert");
    convertMenu.add(convertDCK);

    final JMenuItem helpItem = UIHelper.buildMenu("menu_help_help", 'h', this);
    helpItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0));

    final JMenu helpMenu = new JMenu("?");
    helpMenu.add(helpItem);
    helpMenu.add(deckConstraintsItem);
    helpMenu.add(aboutItem);

    final JMenuBar menuBar = new JMenuBar();
    menuBar.add(mainMenu);
    initAbstractMenu();
    menuBar.add(optionMenu);
    menuBar.add(convertMenu);
    menuBar.add(helpMenu);
    setJMenuBar(menuBar);
    addWindowListener(this);

    // Build the panel containing amount of available cards
    final JLabel amountLeft = new JLabel("<html>0/?", SwingConstants.RIGHT);

    // Build the left list
    allListModel = new MListModel<MCardCompare>(amountLeft, false);
    leftList = new ThreadSafeJList(allListModel);
    leftList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    leftList.setLayoutOrientation(JList.VERTICAL);
    leftList.getSelectionModel().addListSelectionListener(this);
    leftList.addMouseListener(this);
    leftList.setVisibleRowCount(10);

    // Initialize the text field containing the amount to add
    addQtyTxt = new JTextField("1");

    // Build the "Add" button
    addButton = new JButton(LanguageManager.getString("db_add"));
    addButton.setMnemonic('a');
    addButton.setEnabled(false);

    // Build the panel containing : "Add" amount and "Add" button
    final Box addPanel = Box.createHorizontalBox();
    addPanel.add(addButton);
    addPanel.add(addQtyTxt);
    addPanel.setMaximumSize(new Dimension(32010, 26));

    // Build the panel containing the selected card name
    cardNameTxt = new JTextField();
    new HireListener(cardNameTxt, addButton, this, leftList);

    final JLabel searchLabel = new JLabel(LanguageManager.getString("db_search") + " : ");
    searchLabel.setLabelFor(cardNameTxt);

    // Build the panel containing search label and card name text field
    final Box searchPanel = Box.createHorizontalBox();
    searchPanel.add(searchLabel);
    searchPanel.add(cardNameTxt);
    searchPanel.setMaximumSize(new Dimension(32010, 26));

    listScrollerLeft = new JScrollPane(leftList);
    MToolKit.addOverlay(listScrollerLeft);

    // Build the left panel containing : list, available amount, "Add" panel
    final JPanel srcPanel = new JPanel(null);
    srcPanel.add(searchPanel);
    srcPanel.add(listScrollerLeft);
    srcPanel.add(amountLeft);
    srcPanel.add(addPanel);
    srcPanel.setMinimumSize(new Dimension(220, 200));
    srcPanel.setLayout(new BoxLayout(srcPanel, BoxLayout.Y_AXIS));

    // Initialize constraints
    constraintsChecker = new ConstraintsChecker();
    constraintsChecker.setBorder(new EtchedBorder());
    final JScrollPane constraintsCheckerScroll = new JScrollPane(constraintsChecker);
    MToolKit.addOverlay(constraintsCheckerScroll);

    // create a pane with the oracle text for the present card
    oracleText = new JLabel();
    oracleText.setPreferredSize(new Dimension(180, 200));
    oracleText.setVerticalAlignment(SwingConstants.TOP);

    final JScrollPane oracle = new JScrollPane(oracleText, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    MToolKit.addOverlay(oracle);

    // build some Pie Charts and a panel to display it
    initSets();
    datasets = new ChartSets();
    final JTabbedPane tabbedPane = new JTabbedPane();
    for (ChartFilter filter : ChartFilter.values()) {
        final Dataset dataSet = filter.createDataSet(this);
        final JFreeChart chart = new JFreeChart(null, null,
                filter.createPlot(dataSet, painterMapper.get(filter)), false);
        datasets.addDataSet(filter, dataSet);
        ChartPanel pieChartPanel = new ChartPanel(chart, true);
        tabbedPane.add(pieChartPanel, filter.getTitle());
    }
    // add the Constraints scroll panel and Oracle text Pane to the tabbedPane
    tabbedPane.add(constraintsCheckerScroll, LanguageManager.getString("db_constraints"));
    tabbedPane.add(oracle, LanguageManager.getString("db_text"));
    tabbedPane.setSelectedComponent(oracle);

    // The toollBar for color filtering
    toolBar = new JToolBar();
    toolBar.setFloatable(false);
    final JButton clearButton = UIHelper.buildButton("clear");
    clearButton.addActionListener(this);
    toolBar.add(clearButton);
    final JToggleButton toggleColorlessButton = new JToggleButton(
            UIHelper.getTbsIcon("mana/colorless/small/" + MdbLoader.unknownSmlMana), true);
    toggleColorlessButton.setActionCommand("0");
    toggleColorlessButton.addActionListener(this);
    toolBar.add(toggleColorlessButton);
    for (int index = 1; index < IdCardColors.CARD_COLOR_NAMES.length; index++) {
        final JToggleButton toggleButton = new JToggleButton(
                UIHelper.getTbsIcon("mana/colored/small/" + MdbLoader.coloredSmlManas[index]), true);
        toggleButton.setActionCommand(String.valueOf(index));
        toggleButton.addActionListener(this);
        toolBar.add(toggleButton);
    }

    // sorted card type combobox creation
    final List<String> idCards = new ArrayList<String>(Arrays.asList(CardFactory.exportedIdCardNames));
    Collections.sort(idCards);
    final Object[] cardTypes = ArrayUtils.addAll(new String[] { LanguageManager.getString("db_types.any") },
            idCards.toArray());
    idCardComboBox = new JComboBox(cardTypes);
    idCardComboBox.setSelectedIndex(0);
    idCardComboBox.addActionListener(this);
    idCardComboBox.setActionCommand("cardTypeFilter");

    // sorted card properties combobox creation
    final List<String> properties = new ArrayList<String>(
            CardFactory.getPropertiesName(DeckConstraints.getMinProperty(), DeckConstraints.getMaxProperty()));
    Collections.sort(properties);
    final Object[] cardProperties = ArrayUtils
            .addAll(new String[] { LanguageManager.getString("db_properties.any") }, properties.toArray());
    propertiesComboBox = new JComboBox(cardProperties);
    propertiesComboBox.setSelectedIndex(0);
    propertiesComboBox.addActionListener(this);
    propertiesComboBox.setActionCommand("propertyFilter");

    final JLabel colors = new JLabel(" " + LanguageManager.getString("colors") + " : ");
    final JLabel types = new JLabel(" " + LanguageManager.getString("types") + " : ");
    final JLabel property = new JLabel(" " + LanguageManager.getString("properties") + " : ");

    // filter Panel with colors toolBar and card type combobox
    final Box filterPanel = Box.createHorizontalBox();
    filterPanel.add(colors);
    filterPanel.add(toolBar);
    filterPanel.add(types);
    filterPanel.add(idCardComboBox);
    filterPanel.add(property);
    filterPanel.add(propertiesComboBox);

    getContentPane().add(filterPanel, BorderLayout.NORTH);

    // Destination section :

    // Build the panel containing amount of available cards
    final JLabel rightAmount = new JLabel("0/?", SwingConstants.RIGHT);
    rightAmount.setMaximumSize(new Dimension(220, 26));

    // Build the right list
    rightListModel = new MCardTableModel(new MListModel<MCardCompare>(rightAmount, true));
    rightListModel.addTableModelListener(this);
    rightList = new JTable(rightListModel);
    rightList.setShowGrid(false);
    rightList.setTableHeader(null);
    rightList.getSelectionModel().addListSelectionListener(this);
    rightList.getColumnModel().getColumn(0).setMaxWidth(25);
    rightList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);

    // Build the panel containing the selected deck
    deckNameTxt = new JTextField("loading...");
    deckNameTxt.setEditable(false);
    deckNameTxt.setBorder(null);
    final JLabel deckLabel = new JLabel(LanguageManager.getString("db_deck") + " : ");
    deckLabel.setLabelFor(deckNameTxt);
    final Box deckNamePanel = Box.createHorizontalBox();
    deckNamePanel.add(deckLabel);
    deckNamePanel.add(deckNameTxt);
    deckNamePanel.setMaximumSize(new Dimension(220, 26));

    // Initialize the text field containing the amount to remove
    removeQtyTxt = new JTextField("1");

    // Build the "Remove" button
    removeButton = new JButton(LanguageManager.getString("db_remove"));
    removeButton.setMnemonic('r');
    removeButton.addMouseListener(this);
    removeButton.setEnabled(false);

    // Build the panel containing : "Remove" amount and "Remove" button
    final Box removePanel = Box.createHorizontalBox();
    removePanel.add(removeButton);
    removePanel.add(removeQtyTxt);
    removePanel.setMaximumSize(new Dimension(220, 26));

    // Build the right panel containing : list, available amount, constraints
    final JScrollPane deskListScroller = new JScrollPane(rightList);
    MToolKit.addOverlay(deskListScroller);
    deskListScroller.setBorder(BorderFactory.createLineBorder(Color.GRAY));
    deskListScroller.setMinimumSize(new Dimension(220, 200));
    deskListScroller.setMaximumSize(new Dimension(220, 32000));

    final Box destPanel = Box.createVerticalBox();
    destPanel.add(deckNamePanel);
    destPanel.add(deskListScroller);
    destPanel.add(rightAmount);
    destPanel.add(removePanel);
    destPanel.setMinimumSize(new Dimension(220, 200));
    destPanel.setMaximumSize(new Dimension(220, 32000));

    // Build the panel containing the name of card in picture
    cardPictureNameTxt = new JLabel("<html><i>no selected card</i>");
    final Box cardPictureNamePanel = Box.createHorizontalBox();
    cardPictureNamePanel.add(cardPictureNameTxt);
    cardPictureNamePanel.setMaximumSize(new Dimension(32010, 26));

    // Group the detail panels
    final JPanel viewCard = new JPanel(null);
    viewCard.add(cardPictureNamePanel);
    viewCard.add(CardView.getInstance());
    viewCard.add(tabbedPane);
    viewCard.setLayout(new BoxLayout(viewCard, BoxLayout.Y_AXIS));

    final Box mainPanel = Box.createHorizontalBox();
    mainPanel.add(destPanel);
    mainPanel.add(viewCard);

    // Add the main panel
    getContentPane().add(srcPanel, BorderLayout.WEST);
    getContentPane().add(mainPanel, BorderLayout.CENTER);

    // Size this frame
    getRootPane().setPreferredSize(new Dimension(WINDOW_WIDTH, WINDOW_HEIGHT));
    getRootPane().setMinimumSize(getRootPane().getPreferredSize());
    pack();
}

From source file:org.apache.jmeter.protocol.http.config.gui.UrlConfigGui.java

private JPanel getConnectTimeOutPanel() {
    connectTimeOut = new JTextField(10);

    JLabel label = new JLabel(JMeterUtils.getResString("web_server_timeout_connect")); // $NON-NLS-1$
    label.setLabelFor(connectTimeOut);//from  w  w  w .j a  v  a  2s  .c o m

    JPanel panel = new JPanel(new BorderLayout(5, 0));
    panel.add(label, BorderLayout.WEST);
    panel.add(connectTimeOut, BorderLayout.CENTER);

    return panel;
}