Example usage for javax.swing Box createVerticalGlue

List of usage examples for javax.swing Box createVerticalGlue

Introduction

In this page you can find the example usage for javax.swing Box createVerticalGlue.

Prototype

public static Component createVerticalGlue() 

Source Link

Document

Creates a vertical glue component.

Usage

From source file:org.n52.ifgicopter.spf.gui.FrameworkCorePanel.java

/**
 * default constructor to create the framework core panel.
 *//*from w w w.  j  a  v  a  2 s.  c o m*/
public FrameworkCorePanel() {

    /*
     * INPUT PLUGIN LIST
     */
    this.pluginsPanel = new JPanel();
    this.pluginsPanel.setLayout(new GridBagLayout());
    this.pluginsPanel.setBackground(DEFAULT_COLOR);

    this.globalGBC = new GridBagConstraints();
    this.globalGBC.gridx = 0;
    this.globalGBC.gridy = 0;
    this.globalGBC.weightx = 0.0;
    this.globalGBC.weighty = 0.0;
    this.globalGBC.anchor = GridBagConstraints.NORTHWEST;
    this.globalGBC.fill = GridBagConstraints.HORIZONTAL;

    this.pluginsPanel.add(
            new JLabel("<html><body><div><strong>" + "Active Plugins</strong></div></body></html>"),
            this.globalGBC);

    this.globalGBC.gridy++;
    this.globalGBC.gridwidth = GridBagConstraints.REMAINDER;
    this.globalGBC.insets = new Insets(0, 0, 5, 0);
    this.pluginsPanel.add(new JSeparator(), this.globalGBC);
    this.globalGBC.insets = new Insets(0, 0, 0, 0);

    this.globalGBC.weightx = 1.0;
    this.globalGBC.gridy = 0;
    this.globalGBC.gridx = 1;
    this.pluginsPanel.add(Box.createHorizontalGlue(), this.globalGBC);
    this.globalGBC.weightx = 0.0;
    this.globalGBC.gridx = 0;
    this.globalGBC.gridy = 1;

    /*
     * the contentpanel
     */
    this.contentPanel = new JPanel();
    this.contentPanel.setLayout(new CardLayout());
    this.contentPanel.setBorder(BorderFactory.createEtchedBorder());
    this.contentPanel.add(WelcomePanel.getInstance(), WELCOME_PANEL);
    // ((CardLayout) contentPanel.getLayout()).show(contentPanel, WELCOME_PANEL);

    JScrollPane startupS = new JScrollPane(this.contentPanel);
    startupS.setViewportBorder(null);

    /*
     * wrap the plugins to ensure top alignment
     */
    JPanel pluginsPanelWrapper = new JPanel(new BorderLayout());
    pluginsPanelWrapper.add(this.pluginsPanel, BorderLayout.NORTH);
    pluginsPanelWrapper.add(Box.createVerticalGlue(), BorderLayout.CENTER);
    pluginsPanelWrapper.setBorder(BorderFactory.createEtchedBorder());
    pluginsPanelWrapper.setBackground(this.pluginsPanel.getBackground());
    JScrollPane wrapperS = new JScrollPane(pluginsPanelWrapper);
    wrapperS.setViewportBorder(null);

    /*
     * add both scroll panes to the split pane
     */
    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, wrapperS, startupS);
    splitPane.setOneTouchExpandable(true);
    splitPane.setDividerLocation(250);
    splitPane.setContinuousLayout(true);

    Dimension minimumSize = new Dimension(100, 100);
    startupS.setMinimumSize(minimumSize);

    this.setLayout(new BorderLayout());
    this.add(splitPane);
}

From source file:be.ac.ua.comp.scarletnebula.gui.windows.LinkUnlinkWindow.java

private final JPanel getMainPanel() {
    final JPanel mainPanel = new JPanel(new GridBagLayout());
    mainPanel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0));
    final ServerList linkedServerList = new ServerList(linkedServerListModel);
    linkedServerList.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
    final JScrollPane linkedServerScrollPane = new JScrollPane(linkedServerList);
    linkedServerScrollPane//  w ww  .  j  a  v a2  s.  c o  m
            .setBorder(BorderFactory.createTitledBorder(new EmptyBorder(5, 20, 20, 20), "Linked Servers"));
    // Doesn't matter what this is set to, as long as it's the same as the
    // one for unlinkedServerScrollPane
    linkedServerScrollPane.setPreferredSize(new Dimension(10, 10));

    final GridBagConstraints c = new GridBagConstraints();

    c.fill = GridBagConstraints.BOTH;
    c.gridx = 0;
    c.gridy = 0;
    c.weightx = 0.5;
    c.weighty = 1.0;

    mainPanel.add(linkedServerScrollPane, c);

    final ServerList unlinkedServerList = new ServerList(unlinkedServerListModel);
    unlinkedServerList.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
    final JScrollPane unlinkedServerScrollPane = new JScrollPane(unlinkedServerList);
    unlinkedServerScrollPane
            .setBorder(BorderFactory.createTitledBorder(new EmptyBorder(5, 20, 20, 20), "Unlinked Servers"));

    // Doesn't matter what this is set to, as long as it's the same as the
    // one for unlinkedServerScrollPane
    unlinkedServerScrollPane.setPreferredSize(new Dimension(10, 10));

    final JPanel middlePanel = new JPanel();
    middlePanel.setLayout(new BoxLayout(middlePanel, BoxLayout.Y_AXIS));
    middlePanel.add(Box.createVerticalGlue());

    final JButton linkSelectionButton = new JButton("<");
    final JButton unlinkSelectionButton = new JButton(">");

    linkSelectionButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            // Move selection from unlinked to linked list
            final int selection = unlinkedServerList.getSelectedIndex();

            if (selection < 0) {
                return;
            }

            final Server server = unlinkedServerListModel.getVisibleServerAtIndex(selection);

            unlinkedServerListModel.removeServer(server);

            linkedServerListModel.addServer(server);
        }
    });

    unlinkSelectionButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(final ActionEvent e) {
            // Move selection from linked to unlinked list
            final int selection = linkedServerList.getSelectedIndex();

            if (selection < 0) {
                return;
            }

            final int answer = JOptionPane.showOptionDialog(LinkUnlinkWindow.this,
                    "You are about to unlink a server. "
                            + "Unlinking a server will permanently remove \nall data associated with "
                            + "this server, but the server will keep running. "
                            + "\n\nAre you sure you wish to continue?",
                    "Unlink Server", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, null, null, null);

            if (answer != JOptionPane.YES_OPTION) {
                return;
            }

            final Server server = linkedServerListModel.getVisibleServerAtIndex(selection);

            linkedServerListModel.removeServer(server);

            unlinkedServerListModel.addServer(server);
        }
    });

    middlePanel.add(unlinkSelectionButton);
    middlePanel.add(Box.createVerticalStrut(10));
    middlePanel.add(linkSelectionButton);
    middlePanel.add(Box.createVerticalGlue());

    c.gridx = 1;
    c.gridy = 0;
    c.weightx = 0.0;
    c.weighty = 0.0;

    mainPanel.add(middlePanel, c);

    c.gridx = 2;
    c.gridy = 0;
    c.weightx = 0.5;
    c.weighty = 1.0;

    mainPanel.add(unlinkedServerScrollPane, c);
    return mainPanel;
}

From source file:gui.MainGUI.java

public void updateFromRobotTeamConfig() {
    try {/*from  w w w  .  ja v a  2 s . co  m*/
        RobotConfig currRobot;
        RobotPanel currRobotPanel;

        panelRobotInfo.removeAll();
        panelRobotInfo.setLayout(new BoxLayout(panelRobotInfo, BoxLayout.Y_AXIS));
        for (int i = 0; i < robotTeamConfig.getNumRobots(); i++) {
            currRobot = (RobotConfig) (robotTeamConfig.getRobotTeam().get(i + 1));
            currRobotPanel = new RobotPanel(this, currRobot);
            currRobotPanel.getLabelRole().setText(currRobot.getRole().toString());
            panelRobotInfo.add(currRobotPanel);
        }
        panelRobotInfo.add(Box.createVerticalGlue());

        panelRobotInfo.repaint();
        panelRobotInfo.revalidate();
        explorationImage = new ExplorationImage(simConfig.getEnv());
        explorationImage.redrawEnvAndAgents(this, robotTeamConfig, simConfig);
        labelImageHolder.setIcon(new ImageIcon(explorationImage.getImage()));
        validate();
        updateShowSettings();
        updateShowSettingsAgents();
    } catch (NullPointerException e) {
        System.out.println("Updating from robotTeamConfig: null pointer exception.");
    }
}

From source file:ome.formats.importer.gui.FileQueueTable.java

/**
 * Set up and display the file queue table
 *///from   w w w .j a va  2 s.c o m
FileQueueTable() {

    // ----- Variables -----
    // Debug Borders
    Boolean debugBorders = false;

    // Size of the add/remove/refresh buttons (which are square).
    int buttonSize = 40;
    // Add graphic for the refresh button
    //String refreshIcon = "gfx/recycled.png";
    // Add graphic for add button
    String addIcon = "gfx/add.png";
    // Remove graphics for remove button
    String removeIcon = "gfx/remove.png";

    // Width of the status columns
    int statusWidth = 100;

    // ----- GUI Layout Elements -----

    // Start layout here
    setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS));
    setBorder(BorderFactory.createEmptyBorder(6, 5, 9, 8));

    JPanel buttonPanel = new JPanel();
    if (debugBorders == true)
        buttonPanel.setBorder(BorderFactory.createLineBorder(Color.red, 1));
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.PAGE_AXIS));

    //        refreshBtn = addButton("+", refreshIcon, null);
    //        refreshBtn.setMaximumSize(new Dimension(buttonSize, buttonSize));
    //        refreshBtn.setPreferredSize(new Dimension(buttonSize, buttonSize));
    //        refreshBtn.setMinimumSize(new Dimension(buttonSize, buttonSize));
    //        refreshBtn.setSize(new Dimension(buttonSize, buttonSize));
    //        refreshBtn.setActionCommand(Actions.REFRESH);
    //        refreshBtn.addActionListener(this);

    addBtn = GuiCommonElements.addBasicButton(null, addIcon, null);
    addBtn.setMaximumSize(new Dimension(buttonSize, buttonSize));
    addBtn.setPreferredSize(new Dimension(buttonSize, buttonSize));
    addBtn.setMinimumSize(new Dimension(buttonSize, buttonSize));
    addBtn.setSize(new Dimension(buttonSize, buttonSize));
    addBtn.setActionCommand(FileQueueHandler.ADD);
    addBtn.addActionListener(this);
    addBtn.setToolTipText("Add files to the import queue.");

    removeBtn = GuiCommonElements.addBasicButton(null, removeIcon, null);
    removeBtn.setMaximumSize(new Dimension(buttonSize, buttonSize));
    removeBtn.setPreferredSize(new Dimension(buttonSize, buttonSize));
    removeBtn.setMinimumSize(new Dimension(buttonSize, buttonSize));
    removeBtn.setSize(new Dimension(buttonSize, buttonSize));
    removeBtn.setActionCommand(FileQueueHandler.REMOVE);
    removeBtn.addActionListener(this);
    removeBtn.setToolTipText("Remove files from the import queue.");

    buttonPanel.add(Box.createRigidArea(new Dimension(0, 60)));
    //buttonPanel.add(refreshBtn);
    buttonPanel.add(Box.createVerticalGlue());
    buttonPanel.add(addBtn);
    buttonPanel.add(Box.createRigidArea(new Dimension(0, 5)));
    buttonPanel.add(removeBtn);
    buttonPanel.add(Box.createVerticalGlue());
    buttonPanel.add(Box.createRigidArea(new Dimension(0, 60)));
    add(buttonPanel);
    add(Box.createRigidArea(new Dimension(5, 0)));

    JPanel queuePanel = new JPanel();
    if (debugBorders == true)
        queuePanel.setBorder(BorderFactory.createLineBorder(Color.red, 1));
    queuePanel.setLayout(new BoxLayout(queuePanel, BoxLayout.PAGE_AXIS));
    //queuePanel.add(Box.createRigidArea(new Dimension(0,10)));
    JPanel labelPanel = new JPanel();
    labelPanel.setLayout(new BoxLayout(labelPanel, BoxLayout.LINE_AXIS));
    JLabel label = new JLabel("Import Queue:");
    labelPanel.add(label);
    labelPanel.add(Box.createHorizontalGlue());
    groupBtn = GuiCommonElements.addBasicButton("Group: ", null, "Current Group");
    groupBtn.setToolTipText("The user group you are logged into.");
    //groupBtn.setEnabled(false);
    labelPanel.add(groupBtn);
    queuePanel.add(labelPanel);
    queuePanel.add(Box.createRigidArea(new Dimension(0, 5)));

    TableColumnModel cModel = getQueue().getColumnModel();

    headerCellRenderer = new MyTableHeaderRenderer();
    fileCellRenderer = new LeftDotRenderer();
    dpCellRenderer = new CenterTextRenderer();
    statusCellRenderer = new CenterTextRenderer();

    // Create a custom header for the table
    cModel.getColumn(0).setHeaderRenderer(headerCellRenderer);
    cModel.getColumn(1).setHeaderRenderer(headerCellRenderer);
    cModel.getColumn(2).setHeaderRenderer(headerCellRenderer);
    cModel.getColumn(0).setCellRenderer(fileCellRenderer);
    cModel.getColumn(1).setCellRenderer(dpCellRenderer);
    cModel.getColumn(2).setCellRenderer(statusCellRenderer);

    // Set the width of the status column
    TableColumn statusColumn = getQueue().getColumnModel().getColumn(2);
    statusColumn.setPreferredWidth(statusWidth);
    statusColumn.setMaxWidth(statusWidth);
    statusColumn.setMinWidth(statusWidth);

    SelectionListener listener = new SelectionListener(getQueue());
    getQueue().getSelectionModel().addListSelectionListener(listener);
    //queue.getColumnModel().getSelectionModel()
    //    .addListSelectionListener(listener);

    // Hide 3rd to 6th columns
    TableColumnModel tcm = getQueue().getColumnModel();
    TableColumn projectColumn = tcm.getColumn(6);
    tcm.removeColumn(projectColumn);
    TableColumn userPixelColumn = tcm.getColumn(6);
    tcm.removeColumn(userPixelColumn);
    TableColumn userSpecifiedNameColumn = tcm.getColumn(6);
    tcm.removeColumn(userSpecifiedNameColumn);
    TableColumn datasetColumn = tcm.getColumn(3);
    tcm.removeColumn(datasetColumn);
    TableColumn pathColumn = tcm.getColumn(3);
    tcm.removeColumn(pathColumn);
    TableColumn archiveColumn = tcm.getColumn(3);
    tcm.removeColumn(archiveColumn);

    // Add the table to the scollpane
    JScrollPane scrollPane = new JScrollPane(getQueue());

    queuePanel.add(scrollPane);

    JPanel importPanel = new JPanel();
    importPanel.setLayout(new BoxLayout(importPanel, BoxLayout.LINE_AXIS));
    clearDoneBtn = GuiCommonElements.addBasicButton("Clear Done", null, null);
    clearFailedBtn = GuiCommonElements.addBasicButton("Clear Failed", null, null);
    importBtn = GuiCommonElements.addBasicButton("Import", null, null);
    importPanel.add(Box.createHorizontalGlue());
    importPanel.add(clearDoneBtn);
    clearDoneBtn.setEnabled(false);
    clearDoneBtn.setActionCommand(FileQueueHandler.CLEARDONE);
    clearDoneBtn.addActionListener(this);
    clearDoneBtn.setToolTipText("Clear all 'done' entries from the import queue.");
    importPanel.add(Box.createRigidArea(new Dimension(0, 5)));
    importPanel.add(clearFailedBtn);
    clearFailedBtn.setEnabled(false);
    clearFailedBtn.setActionCommand(FileQueueHandler.CLEARFAILED);
    clearFailedBtn.addActionListener(this);
    clearFailedBtn.setToolTipText("Clear all 'failed' entries from the import queue.");
    importPanel.add(Box.createRigidArea(new Dimension(0, 10)));
    importPanel.add(importBtn);
    importBtn.setEnabled(false);
    importBtn.setActionCommand(FileQueueHandler.IMPORT);
    importBtn.addActionListener(this);
    importBtn.setToolTipText("Begin importing files.");
    GuiCommonElements.enterPressesWhenFocused(importBtn);
    queuePanel.add(Box.createRigidArea(new Dimension(0, 5)));
    queuePanel.add(importPanel);
    add(queuePanel);
}

From source file:org.esa.snap.smart.configurator.ui.PerformancePanel.java

/**
 * This method is called from within the constructor to initialize the form.
 *///w w w . j a v a2 s  . c o m
private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;

    systemParametersPanel = new javax.swing.JPanel();
    cachePathLabel = new javax.swing.JLabel();
    vmParametersTextField = new javax.swing.JTextField();
    editVMParametersButton = new javax.swing.JButton();
    cachePathTextField = new javax.swing.JTextField();
    browseUserDirButton = new javax.swing.JButton();
    vmParametersLabel = new javax.swing.JLabel();
    sysResetButton = new javax.swing.JButton();
    sysComputeButton = new javax.swing.JButton();
    largeCacheInfoLabel = new javax.swing.JLabel();
    vmParametersInfoLabel = new javax.swing.JLabel();
    processingParametersPanel = new javax.swing.JPanel();
    jPanel2 = new javax.swing.JPanel();
    tileWidthLabel = new javax.swing.JLabel();
    cacheSizeLabel = new javax.swing.JLabel();
    nbThreadsLabel = new javax.swing.JLabel();
    jPanel1 = new javax.swing.JPanel();
    defaultTileSizeTextField = new javax.swing.JTextField();
    cacheSizeTextField = new javax.swing.JTextField();
    nbThreadsTextField = new javax.swing.JTextField();
    jPanel4 = new javax.swing.JPanel();
    benchmarkTileSizeTextField = new javax.swing.JTextField();
    benchmarkCacheSizeTextField = new javax.swing.JTextField();
    benchmarkNbThreadsTextField = new javax.swing.JTextField();
    jLabel1 = new javax.swing.JLabel();

    procGraphJComboBox = new javax.swing.JComboBox(getBenchmarkOperators());
    jPanel3 = new javax.swing.JPanel();
    processingParamsComputeButton = new javax.swing.JButton();
    processingParamsResetButton = new javax.swing.JButton();

    BoxLayout perfPanelLayout = new BoxLayout(this, BoxLayout.Y_AXIS);
    setLayout(perfPanelLayout);

    Box.createVerticalGlue();

    systemParametersPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle
            .getMessage(PerformancePanel.class, "PerformancePanel.systemParametersPanel.border.title")));
    systemParametersPanel.setMinimumSize(new java.awt.Dimension(283, 115));
    systemParametersPanel.setLayout(new java.awt.GridBagLayout());

    org.openide.awt.Mnemonics.setLocalizedText(cachePathLabel,
            org.openide.util.NbBundle.getMessage(PerformancePanel.class, "PerformancePanel.jLabel2.text"));
    cachePathLabel.setMaximumSize(new java.awt.Dimension(100, 14));
    cachePathLabel.setPreferredSize(new java.awt.Dimension(80, 14));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(5, 10, 0, 0);
    systemParametersPanel.add(cachePathLabel, gridBagConstraints);

    org.openide.awt.Mnemonics.setLocalizedText(vmParametersLabel,
            org.openide.util.NbBundle.getMessage(PerformancePanel.class, "PerformancePanel.jLabel3.text"));
    vmParametersLabel.setMaximumSize(new java.awt.Dimension(200, 14));
    vmParametersLabel.setMinimumSize(new java.awt.Dimension(100, 14));
    vmParametersLabel.setPreferredSize(new java.awt.Dimension(80, 14));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(5, 10, 0, 0);
    systemParametersPanel.add(vmParametersLabel, gridBagConstraints);

    vmParametersTextField.setText(org.openide.util.NbBundle.getMessage(PerformancePanel.class,
            "PerformancePanel.vmParametersTextField.text"));
    vmParametersTextField.setToolTipText(org.openide.util.NbBundle.getMessage(PerformancePanel.class,
            "PerformancePanel.vmParametersTextField.toolTipText"));
    if (!VMParameters.canSave()) {
        vmParametersTextField.setEditable(false);
    }
    vmParametersTextField.setColumns(50);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridwidth = java.awt.GridBagConstraints.RELATIVE;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 2.0;
    gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 0);
    systemParametersPanel.add(vmParametersTextField, gridBagConstraints);

    org.openide.awt.Mnemonics.setLocalizedText(editVMParametersButton, org.openide.util.NbBundle
            .getMessage(PerformancePanel.class, "PerformancePanel.editVMParametersButton.text"));
    editVMParametersButton.addActionListener(this::editVMParametersButtonActionPerformed);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(5, 2, 0, 10);
    systemParametersPanel.add(editVMParametersButton, gridBagConstraints);

    if (!VMParameters.canSave()) {
        vmParametersLabel.setEnabled(false);
        vmParametersTextField.setEnabled(false);
        editVMParametersButton.setEnabled(false);
        String vmParameterDisableToolTip = "VM parameters can't be saved from SNAP, please use the snap-conf-optimiser application as an administrator to change them";
        vmParametersLabel.setToolTipText(vmParameterDisableToolTip);
        vmParametersTextField.setToolTipText(vmParameterDisableToolTip);
        editVMParametersButton.setToolTipText(vmParameterDisableToolTip);
    }

    cachePathTextField.setText(org.openide.util.NbBundle.getMessage(PerformancePanel.class,
            "PerformancePanel.userDirTextField.text"));
    cachePathTextField.setToolTipText(org.openide.util.NbBundle.getMessage(PerformancePanel.class,
            "PerformancePanel.userDirTextField.toolTipText"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.gridwidth = java.awt.GridBagConstraints.RELATIVE;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 2.0;
    gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 0);
    systemParametersPanel.add(cachePathTextField, gridBagConstraints);

    org.openide.awt.Mnemonics.setLocalizedText(browseUserDirButton, org.openide.util.NbBundle
            .getMessage(PerformancePanel.class, "PerformancePanel.browseUserDirButton.text"));
    browseUserDirButton.addActionListener(evt -> browseCachePathButtonActionPerformed());
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(5, 2, 0, 10);
    systemParametersPanel.add(browseUserDirButton, gridBagConstraints);

    org.openide.awt.Mnemonics.setLocalizedText(sysResetButton, org.openide.util.NbBundle
            .getMessage(PerformancePanel.class, "PerformancePanel.sysResetButton.text"));
    sysResetButton.addActionListener(evt -> sysResetButtonActionPerformed());
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.insets = new java.awt.Insets(10, 3, 0, 10);
    systemParametersPanel.add(sysResetButton, gridBagConstraints);

    org.openide.awt.Mnemonics.setLocalizedText(sysComputeButton, org.openide.util.NbBundle
            .getMessage(PerformancePanel.class, "PerformancePanel.sysComputeButton.text"));
    sysComputeButton.addActionListener(evt -> sysComputeButtonActionPerformed());
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(10, 0, 0, 3);
    systemParametersPanel.add(sysComputeButton, gridBagConstraints);

    org.openide.awt.Mnemonics.setLocalizedText(largeCacheInfoLabel, org.openide.util.NbBundle
            .getMessage(PerformancePanel.class, "PerformancePanel.largeCacheInfoLabel.text"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    systemParametersPanel.add(largeCacheInfoLabel, gridBagConstraints);

    org.openide.awt.Mnemonics.setLocalizedText(vmParametersInfoLabel, org.openide.util.NbBundle
            .getMessage(PerformancePanel.class, "PerformancePanel.vmParametersInfoLabel.text"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    systemParametersPanel.add(vmParametersInfoLabel, gridBagConstraints);

    add(systemParametersPanel);

    Box.createVerticalGlue();

    processingParametersPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(
            org.openide.util.NbBundle.getMessage(PerformancePanel.class, "PerformancePanel.border.title")));
    processingParametersPanel.setName("");
    processingParametersPanel.setLayout(new java.awt.GridBagLayout());

    jPanel2.setLayout(new java.awt.GridLayout(3, 0, 0, 15));

    org.openide.awt.Mnemonics.setLocalizedText(tileWidthLabel, org.openide.util.NbBundle
            .getMessage(PerformancePanel.class, "PerformancePanel.tileWidthLabel.text"));
    tileWidthLabel.setMaximumSize(new java.awt.Dimension(120, 14));
    tileWidthLabel.setPreferredSize(new java.awt.Dimension(100, 14));
    jPanel2.add(tileWidthLabel);

    org.openide.awt.Mnemonics.setLocalizedText(cacheSizeLabel, org.openide.util.NbBundle
            .getMessage(PerformancePanel.class, "PerformancePanel.cacheSizeLabel.text"));
    cacheSizeLabel.setMaximumSize(new java.awt.Dimension(100, 14));
    cacheSizeLabel.setPreferredSize(new java.awt.Dimension(80, 14));
    jPanel2.add(cacheSizeLabel);

    org.openide.awt.Mnemonics.setLocalizedText(nbThreadsLabel, org.openide.util.NbBundle
            .getMessage(PerformancePanel.class, "PerformancePanel.nbThreadsLabel.text"));
    nbThreadsLabel.setMaximumSize(new java.awt.Dimension(100, 14));
    jPanel2.add(nbThreadsLabel);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.insets = new java.awt.Insets(10, 10, 0, 0);
    processingParametersPanel.add(jPanel2, gridBagConstraints);

    jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle
            .getMessage(PerformancePanel.class, "PerformancePanel.jPanel1.border.title")));
    jPanel1.setMinimumSize(new java.awt.Dimension(100, 100));
    jPanel1.setLayout(new java.awt.GridLayout(3, 1, 0, 10));

    defaultTileSizeTextField.setText(org.openide.util.NbBundle.getMessage(PerformancePanel.class,
            "PerformancePanel.defaultTileSizeTextField.text"));
    defaultTileSizeTextField.setMinimumSize(new java.awt.Dimension(100, 20));
    defaultTileSizeTextField.setPreferredSize(new java.awt.Dimension(100, 20));
    jPanel1.add(defaultTileSizeTextField);

    cacheSizeTextField.setText(org.openide.util.NbBundle.getMessage(PerformancePanel.class,
            "PerformancePanel.cacheSizeTextField.text"));
    cacheSizeTextField.setMinimumSize(new java.awt.Dimension(100, 20));
    cacheSizeTextField.setName("");
    cacheSizeTextField.setPreferredSize(new java.awt.Dimension(100, 20));
    jPanel1.add(cacheSizeTextField);

    nbThreadsTextField.setText(org.openide.util.NbBundle.getMessage(PerformancePanel.class,
            "PerformancePanel.nbThreadsTextField.text"));
    nbThreadsTextField.setPreferredSize(new java.awt.Dimension(100, 20));
    jPanel1.add(nbThreadsTextField);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    processingParametersPanel.add(jPanel1, gridBagConstraints);

    jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle
            .getMessage(PerformancePanel.class, "PerformancePanel.jPanel4.border.title")));
    jPanel4.setMinimumSize(new java.awt.Dimension(190, 107));
    jPanel4.setLayout(new java.awt.GridLayout(3, 1, 0, 10));

    PerformanceParameters actualParameters = confOptimizer.getActualPerformanceParameters();
    String tileSizeBenchmarkValues = getDefaultTileSizeValuesForBenchmark(
            actualParameters.getDefaultTileSize());
    benchmarkTileSizeTextField.setText(tileSizeBenchmarkValues);
    benchmarkTileSizeTextField.setPreferredSize(new java.awt.Dimension(150, 20));
    jPanel4.add(benchmarkTileSizeTextField);

    String cacheSizeBenchmarkValues = getDefaultCacheSizeValuesForBenchmark(actualParameters);
    benchmarkCacheSizeTextField.setText(cacheSizeBenchmarkValues);
    benchmarkCacheSizeTextField.setMinimumSize(new java.awt.Dimension(100, 20));
    benchmarkCacheSizeTextField.setName("");
    benchmarkCacheSizeTextField.setPreferredSize(new java.awt.Dimension(150, 20));
    jPanel4.add(benchmarkCacheSizeTextField);

    benchmarkNbThreadsTextField
            .setText(Integer.toString(actualParameters.getNbThreads()) + BENCHMARK_SEPARATOR);
    benchmarkNbThreadsTextField.setPreferredSize(new java.awt.Dimension(150, 20));
    jPanel4.add(benchmarkNbThreadsTextField);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 2.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 10);
    processingParametersPanel.add(jPanel4, gridBagConstraints);

    org.openide.awt.Mnemonics.setLocalizedText(jLabel1,
            org.openide.util.NbBundle.getMessage(PerformancePanel.class, "PerformancePanel.jLabel1.text"));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(5, 10, 0, 0);
    processingParametersPanel.add(jLabel1, gridBagConstraints);

    procGraphJComboBox.setMinimumSize(new java.awt.Dimension(180, 22));
    nbThreadsTextField.setMinimumSize(new java.awt.Dimension(100, 20));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.insets = new java.awt.Insets(5, 0, 0, 10);
    processingParametersPanel.add(procGraphJComboBox, gridBagConstraints);

    org.openide.awt.Mnemonics.setLocalizedText(processingParamsComputeButton,
            org.openide.util.NbBundle.getMessage(PerformancePanel.class, "PerformancePanel.text"));
    processingParamsComputeButton.setName("");
    processingParamsComputeButton.addActionListener(this::processingParamsComputeButtonActionPerformed);
    jPanel3.add(processingParamsComputeButton);

    org.openide.awt.Mnemonics.setLocalizedText(processingParamsResetButton, org.openide.util.NbBundle
            .getMessage(PerformancePanel.class, "PerformancePanel.processingParamsResetButton.text"));
    processingParamsResetButton.addActionListener(this::processingParamsResetButtonActionPerformed);
    jPanel3.add(processingParamsResetButton);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 5);
    processingParametersPanel.add(jPanel3, gridBagConstraints);

    add(processingParametersPanel);
}

From source file:org.obiba.onyx.jade.instrument.summitdoppler.VantageABIInstrumentRunner.java

protected JPanel buildFileSelectionSubPanel() {
    final JPanel panel = new JPanel();

    panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    panel.add(Box.createVerticalGlue());

    JButton openButton = new JButton(resourceBundle.getString("Select_file"));
    openButton.setMnemonic('O');
    openButton.setToolTipText(resourceBundle.getString("ToolTip.Select_file"));
    panel.add(openButton);//from  w  w  w  .ja v  a2s . co m
    panel.add(Box.createRigidArea(new Dimension(10, 10)));

    JLabel fileLabel = new ABIFileLabel();
    panel.add(fileLabel);

    // Open button listener.
    openButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            int returnVal = fileChooser.showOpenDialog(appWindow);
            if (returnVal == JFileChooser.APPROVE_OPTION) {
                abiFile = fileChooser.getSelectedFile();
                panel.repaint();
                saveButton.setEnabled(true);
            }
        }
    });

    panel.setAlignmentX(Component.LEFT_ALIGNMENT);

    return panel;
}

From source file:au.edu.uwa.csse.plot.Clustering.java

private void setUpView(Graph graph) throws IOException {

    //Create a simple layout frame
    //specify the Fruchterman-Rheingold layout algorithm
    final AggregateLayout<Integer, Number> layout = new AggregateLayout<Integer, Number>(
            new FRLayout<Integer, Number>(graph));

    vv = new VisualizationViewer<Integer, Number>(layout);
    vv.setBackground(Color.white);
    vv.setVertexToolTipTransformer(Plot.vertexLabelTransformer);
    //Tell the renderer to use our own customized color rendering
    vv.getRenderContext()/*from w w w  .j a  va 2s . com*/
            .setVertexFillPaintTransformer(MapTransformer.<Integer, Paint>getInstance(vertexPaints));
    vv.getRenderContext().setVertexDrawPaintTransformer(new Transformer<Integer, Paint>() {
        public Paint transform(Integer v) {
            if (vv.getPickedVertexState().isPicked(v)) {
                return Color.cyan;
            } else {
                return Color.BLACK;
            }
        }
    });

    vv.getRenderContext().setEdgeDrawPaintTransformer(MapTransformer.<Number, Paint>getInstance(edgePaints));

    vv.getRenderContext().setEdgeStrokeTransformer(new Transformer<Number, Stroke>() {
        protected final Stroke THIN = new BasicStroke(1);
        protected final Stroke THICK = new BasicStroke(2);

        public Stroke transform(Number e) {
            Paint c = edgePaints.get(e);
            if (c == Color.LIGHT_GRAY)
                return THIN;
            else
                return THICK;
        }
    });

    //add restart button
    JButton scramble = new JButton("Restart");
    scramble.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            Layout layout = vv.getGraphLayout();
            layout.initialize();
            Relaxer relaxer = vv.getModel().getRelaxer();
            if (relaxer != null) {
                relaxer.stop();
                relaxer.prerelax();
                relaxer.relax();
            }
        }

    });

    DefaultModalGraphMouse gm = new DefaultModalGraphMouse();
    vv.setGraphMouse(gm);

    final JToggleButton groupVertices = new JToggleButton("Group Clusters");

    //Create slider to adjust the number of edges to remove when clustering
    final JSlider edgeBetweennessSlider = new JSlider(JSlider.HORIZONTAL);
    edgeBetweennessSlider.setBackground(Color.WHITE);
    edgeBetweennessSlider.setPreferredSize(new Dimension(210, 50));
    edgeBetweennessSlider.setPaintTicks(true);
    edgeBetweennessSlider.setMaximum(graph.getEdgeCount());
    edgeBetweennessSlider.setMinimum(0);
    edgeBetweennessSlider.setValue(0);
    edgeBetweennessSlider.setMajorTickSpacing(10);
    edgeBetweennessSlider.setPaintLabels(true);
    edgeBetweennessSlider.setPaintTicks(true);

    //      edgeBetweennessSlider.setBorder(BorderFactory.createLineBorder(Color.black));
    //TO DO: edgeBetweennessSlider.add(new JLabel("Node Size (PageRank With Priors):"));
    //I also want the slider value to appear
    final JPanel eastControls = new JPanel();
    eastControls.setOpaque(true);
    eastControls.setLayout(new BoxLayout(eastControls, BoxLayout.Y_AXIS));
    eastControls.add(Box.createVerticalGlue());
    eastControls.add(edgeBetweennessSlider);

    final String COMMANDSTRING = "Edges removed for clusters: ";
    final String eastSize = COMMANDSTRING + edgeBetweennessSlider.getValue();

    final TitledBorder sliderBorder = BorderFactory.createTitledBorder(eastSize);
    eastControls.setBorder(sliderBorder);
    //eastControls.add(eastSize);
    eastControls.add(Box.createVerticalGlue());

    groupVertices.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            clusterAndRecolor(layout, edgeBetweennessSlider.getValue(), similarColors,
                    e.getStateChange() == ItemEvent.SELECTED);
            vv.repaint();
        }
    });

    clusterAndRecolor(layout, 0, similarColors, groupVertices.isSelected());

    edgeBetweennessSlider.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            JSlider source = (JSlider) e.getSource();
            if (!source.getValueIsAdjusting()) {
                int numEdgesToRemove = source.getValue();
                clusterAndRecolor(layout, numEdgesToRemove, similarColors, groupVertices.isSelected());
                sliderBorder.setTitle(COMMANDSTRING + edgeBetweennessSlider.getValue());
                eastControls.repaint();
                vv.validate();
                vv.repaint();
            }
        }
    });

    Container content = getContentPane();
    content.add(new GraphZoomScrollPane(vv));
    JPanel south = new JPanel();
    JPanel grid = new JPanel(new GridLayout(2, 1));
    grid.add(scramble);
    grid.add(groupVertices);
    south.add(grid);
    south.add(eastControls);
    JPanel p = new JPanel();
    p.setBorder(BorderFactory.createTitledBorder("Mouse Mode"));
    p.add(gm.getModeComboBox());
    south.add(p);
    content.add(south, BorderLayout.SOUTH);
}

From source file:be.vds.jtbdive.client.view.core.dive.profile.DiveProfileGraphicDetailPanel.java

private Component createControls() {
    JPanel controlPanel = new JPanel(new GridBagLayout());
    controlPanel.setOpaque(false);/*from w ww . jav  a2 s  .  c  o  m*/

    GridBagConstraints c = new GridBagConstraints();
    c.insets = new Insets(5, 5, 5, 5);

    GridBagLayoutManager.addComponent(controlPanel, createInstantDataPanel(), c, 0, 0, 1, 1, 0, 0,
            GridBagConstraints.BOTH, GridBagConstraints.CENTER);

    GridBagLayoutManager.addComponent(controlPanel, createWarningsPanel(), c, 0, 1, 1, 1, 0, 0,
            GridBagConstraints.BOTH, GridBagConstraints.CENTER);

    GridBagLayoutManager.addComponent(controlPanel, createOptionsPanel(), c, 0, 2, 1, 1, 0, 0,
            GridBagConstraints.BOTH, GridBagConstraints.CENTER);

    GridBagLayoutManager.addComponent(controlPanel, createEditorButton(), c, 0, 3, 1, 1, 0, 0,
            GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTH);

    GridBagLayoutManager.addComponent(controlPanel, createImportExportButtons(), c, 0, 4, 1, 1, 0, 0,
            GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTH);

    GridBagLayoutManager.addComponent(controlPanel, Box.createVerticalGlue(), c, 0, 5, 1, 1, 1, 1,
            GridBagConstraints.VERTICAL, GridBagConstraints.CENTER);

    return controlPanel;
}

From source file:net.pandoragames.far.ui.swing.RenameFilesPanel.java

private void init(SwingConfig config, ComponentRepository componentRepository) {

    this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

    this.setBorder(
            BorderFactory.createEmptyBorder(0, SwingConfig.PADDING, SwingConfig.PADDING, SwingConfig.PADDING));

    this.add(Box.createRigidArea(new Dimension(1, SwingConfig.PADDING)));
    JLabel patternLabel = new JLabel(localizer.localize("label.find-pattern"));
    this.add(patternLabel);
    filenamePattern = new JTextField();
    filenamePattern.setPreferredSize(/*from w w w.  j  a  v  a2  s  . com*/
            new Dimension(SwingConfig.COMPONENT_WIDTH_LARGE, config.getStandardComponentHight()));
    filenamePattern
            .setMaximumSize(new Dimension(SwingConfig.COMPONENT_WIDTH_MAX, config.getStandardComponentHight()));
    filenamePattern.setAlignmentX(Component.LEFT_ALIGNMENT);
    UndoHistory findUndoManager = new UndoHistory();
    findUndoManager.registerUndoHistory(filenamePattern);
    findUndoManager.registerSnapshotHistory(filenamePattern);
    componentRepository.getReplaceCommand().addResetable(findUndoManager);
    filenamePattern.getDocument().addDocumentListener(new DocumentChangeListener() {
        public void documentUpdated(DocumentEvent e, String text) {
            dataModel.setPatternString(text);
            updateFileTable();
        }
    });
    componentRepository.getResetDispatcher().addToBeCleared(filenamePattern);
    this.add(filenamePattern);
    JCheckBox caseBox = new JCheckBox(localizer.localize("label.ignore-case"));
    caseBox.setSelected(true);
    caseBox.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent event) {
            dataModel.setIgnoreCase((ItemEvent.SELECTED == event.getStateChange()));
            updateFileTable();
        }
    });
    this.add(caseBox);
    JCheckBox regexBox = new JCheckBox(localizer.localize("label.regular-expression"));
    regexBox.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent event) {
            dataModel.setRegexPattern((ItemEvent.SELECTED == event.getStateChange()));
            updateFileTable();
        }
    });
    this.add(regexBox);
    JPanel extensionPanel = new JPanel();
    extensionPanel.setBorder(BorderFactory.createTitledBorder(localizer.localize("label.modify-extension")));
    extensionPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
    extensionPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    extensionPanel.setPreferredSize(new Dimension(SwingConfig.COMPONENT_WIDTH_LARGE, 60));
    extensionPanel.setMaximumSize(new Dimension(SwingConfig.COMPONENT_WIDTH_MAX, 100));
    ButtonGroup extensionGroup = new ButtonGroup();
    JRadioButton protectButton = new JRadioButton(localizer.localize("label.protect-extension"));
    protectButton.setSelected(true);
    protectButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            dataModel.setProtectExtension(true);
            updateFileTable();
        }
    });
    extensionGroup.add(protectButton);
    extensionPanel.add(protectButton);
    JRadioButton includeButton = new JRadioButton(localizer.localize("label.include-extension"));
    includeButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            dataModel.setExtensionOnly(false);
            dataModel.setProtectExtension(false);
            updateFileTable();
        }
    });
    extensionGroup.add(includeButton);
    extensionPanel.add(includeButton);
    JRadioButton onlyButton = new JRadioButton(localizer.localize("label.only-extension"));
    onlyButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            dataModel.setExtensionOnly(true);
            updateFileTable();
        }
    });
    extensionGroup.add(onlyButton);
    extensionPanel.add(onlyButton);
    this.add(extensionPanel);

    this.add(Box.createVerticalGlue());
    this.add(Box.createRigidArea(new Dimension(1, SwingConfig.PADDING)));

    // replace
    JLabel replaceLabel = new JLabel(localizer.localize("label.replacement-pattern"));
    this.add(replaceLabel);
    replacePattern = new JTextField();
    replacePattern.setPreferredSize(
            new Dimension(SwingConfig.COMPONENT_WIDTH_LARGE, config.getStandardComponentHight()));
    replacePattern
            .setMaximumSize(new Dimension(SwingConfig.COMPONENT_WIDTH_MAX, config.getStandardComponentHight()));
    replacePattern.setAlignmentX(Component.LEFT_ALIGNMENT);
    UndoHistory undoManager = new UndoHistory();
    undoManager.registerUndoHistory(replacePattern);
    undoManager.registerSnapshotHistory(replacePattern);
    componentRepository.getReplaceCommand().addResetable(undoManager);
    replacePattern.getDocument().addDocumentListener(new DocumentChangeListener() {
        public void documentUpdated(DocumentEvent e, String text) {
            dataModel.setReplacementString(text);
            updateFileTable();
        }
    });
    componentRepository.getResetDispatcher().addToBeCleared(replacePattern);
    this.add(replacePattern);

    // treat case
    JPanel modifyCasePanel = new JPanel();
    modifyCasePanel.setBorder(BorderFactory.createTitledBorder(localizer.localize("label.modify-case")));
    modifyCasePanel.setLayout(new BoxLayout(modifyCasePanel, BoxLayout.Y_AXIS));
    modifyCasePanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    modifyCasePanel.setPreferredSize(new Dimension(SwingConfig.COMPONENT_WIDTH_LARGE, 100));
    modifyCasePanel.setMaximumSize(new Dimension(SwingConfig.COMPONENT_WIDTH_MAX, 200));
    ButtonGroup modifyCaseGroup = new ButtonGroup();
    ActionListener radioButtonListener = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            String cmd = e.getActionCommand();
            dataModel.setTreatCase(RenameForm.CASEHANDLING.valueOf(cmd));
            updateFileTable();
        }
    };
    JRadioButton lowerButton = new JRadioButton(localizer.localize("label.to-lower-case"));
    lowerButton.setActionCommand(RenameForm.CASEHANDLING.LOWER.name());
    lowerButton.addActionListener(radioButtonListener);
    modifyCaseGroup.add(lowerButton);
    modifyCasePanel.add(lowerButton);
    JRadioButton upperButton = new JRadioButton(localizer.localize("label.to-upper-case"));
    upperButton.setActionCommand(RenameForm.CASEHANDLING.UPPER.name());
    upperButton.addActionListener(radioButtonListener);
    modifyCaseGroup.add(upperButton);
    modifyCasePanel.add(upperButton);
    JRadioButton keepButton = new JRadioButton(localizer.localize("label.preserve-case"));
    keepButton.setActionCommand(RenameForm.CASEHANDLING.PRESERVE.name());
    keepButton.setSelected(true);
    keepButton.addActionListener(radioButtonListener);
    modifyCaseGroup.add(keepButton);
    modifyCasePanel.add(keepButton);
    this.add(modifyCasePanel);

    // prevent case conflict
    JCheckBox caseConflictBox = new JCheckBox(localizer.localize("label.prevent-case-conflict"));
    caseConflictBox.setAlignmentX(Component.LEFT_ALIGNMENT);
    caseConflictBox.setSelected(true);
    caseConflictBox.setEnabled(!SwingConfig.isWindows()); // disabled on windows
    caseConflictBox.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent event) {
            dataModel.setPreventCaseConflict((ItemEvent.SELECTED == event.getStateChange()));
            updateFileTable();
        }
    });
    this.add(caseConflictBox);

    this.add(Box.createVerticalGlue());

}

From source file:pcgen.gui2.dialog.ChooserDialog.java

private void initComponents() {
    setTitle(chooser.getName());/*from   w  ww  . j  ava 2  s  .  com*/
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    addWindowListener(new WindowAdapter() {

        @Override
        public void windowClosed(WindowEvent e) {
            //detach listeners from the chooser
            treeViewModel.setDelegate(null);
            listModel.setListFacade(null);
            chooser.getRemainingSelections().removeReferenceListener(ChooserDialog.this);
        }

    });
    Container pane = getContentPane();
    pane.setLayout(new BorderLayout());

    JSplitPane split = new JSplitPane();
    JPanel leftPane = new JPanel(new BorderLayout());
    if (availTable != null) {
        availTable.setAutoCreateRowSorter(true);
        availTable.setTreeViewModel(treeViewModel);
        availTable.getRowSorter().toggleSortOrder(0);
        availTable.addActionListener(this);
        leftPane.add(new JScrollPane(availTable), BorderLayout.CENTER);
    } else {
        availInput.addActionListener(this);
        Dimension maxDim = new Dimension(Integer.MAX_VALUE, availInput.getPreferredSize().height);
        availInput.setMaximumSize(maxDim);
        JPanel availPanel = new JPanel();
        availPanel.setLayout(new BoxLayout(availPanel, BoxLayout.PAGE_AXIS));
        availPanel.add(Box.createRigidArea(new Dimension(10, 30)));
        availPanel.add(Box.createVerticalGlue());
        availPanel.add(new JLabel(LanguageBundle.getString("in_uichooser_value")));
        availPanel.add(availInput);
        availPanel.add(Box.createVerticalGlue());
        leftPane.add(availPanel, BorderLayout.WEST);
    }

    JPanel buttonPane1 = new JPanel(new FlowLayout());
    JButton addButton = new JButton(chooser.getAddButtonName());
    addButton.setActionCommand("ADD");
    addButton.addActionListener(this);
    buttonPane1.add(addButton);
    buttonPane1.add(new JLabel(Icons.Forward16.getImageIcon()));
    leftPane.add(buttonPane1, BorderLayout.SOUTH);

    split.setLeftComponent(leftPane);

    JPanel rightPane = new JPanel(new BorderLayout());
    JPanel labelPane = new JPanel(new GridBagLayout());

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    labelPane.add(new JLabel(chooser.getSelectionCountName()), new GridBagConstraints());
    remainingLabel.setText(chooser.getRemainingSelections().get().toString());
    labelPane.add(remainingLabel, gbc);
    labelPane.add(new JLabel(chooser.getSelectedTableTitle()), gbc);
    rightPane.add(labelPane, BorderLayout.NORTH);

    list.setModel(listModel);
    list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    list.addActionListener(this);
    rightPane.add(new JScrollPane(list), BorderLayout.CENTER);

    JPanel buttonPane2 = new JPanel(new FlowLayout());
    buttonPane2.add(new JLabel(Icons.Back16.getImageIcon()));
    JButton removeButton = new JButton(chooser.getRemoveButtonName());
    removeButton.setActionCommand("REMOVE");
    removeButton.addActionListener(this);
    buttonPane2.add(removeButton);
    rightPane.add(buttonPane2, BorderLayout.SOUTH);

    split.setRightComponent(rightPane);

    if (chooser.isInfoAvailable()) {
        JSplitPane infoSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
        infoSplit.setTopComponent(split);
        infoSplit.setBottomComponent(infoPane);
        infoSplit.setResizeWeight(0.8);
        pane.add(infoSplit, BorderLayout.CENTER);
        if (availTable != null) {
            availTable.getSelectionModel().addListSelectionListener(this);
        }
    } else {
        pane.add(split, BorderLayout.CENTER);
    }
    JPanel bottomPane = new JPanel(new FlowLayout());
    JButton button = new JButton(LanguageBundle.getString("in_ok")); //$NON-NLS-1$
    button.setMnemonic(LanguageBundle.getMnemonic("in_mn_ok")); //$NON-NLS-1$
    button.setActionCommand("OK");
    button.addActionListener(this);
    bottomPane.add(button);
    button = new JButton(LanguageBundle.getString("in_cancel")); //$NON-NLS-1$
    button.setMnemonic(LanguageBundle.getMnemonic("in_mn_cancel")); //$NON-NLS-1$
    button.setActionCommand("CANCEL");
    button.addActionListener(this);
    bottomPane.add(button);
    pane.add(bottomPane, BorderLayout.SOUTH);
}