Example usage for javax.swing Box createRigidArea

List of usage examples for javax.swing Box createRigidArea

Introduction

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

Prototype

public static Component createRigidArea(Dimension d) 

Source Link

Document

Creates an invisible component that's always the specified size.

Usage

From source file:ro.nextreports.designer.wizpublish.DownloadListWizardPanel.java

private void init() {
    setLayout(new GridBagLayout());

    btnAdd.setIcon(ImageUtil.getImageIcon("add"));
    btnAdd.setPreferredSize(btnDim);//from  www  . ja  v  a2s.  c o  m
    btnAdd.setMinimumSize(btnDim);
    btnAdd.setMaximumSize(btnDim);
    btnAdd.setToolTipText(I18NSupport.getString("listselectionpanel.add"));
    btnAdd.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            add();
        }
    });

    btnRem.setIcon(ImageUtil.getImageIcon("delete"));
    btnRem.setPreferredSize(btnDim);
    btnRem.setMinimumSize(btnDim);
    btnRem.setMaximumSize(btnDim);
    btnRem.setToolTipText(I18NSupport.getString("listselectionpanel.remove"));
    btnRem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            remove();
        }
    });

    list.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() == 2) {
                remove();
            }
        }
    });

    scrList.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    scrList.setMinimumSize(scrDim);
    scrList.setPreferredSize(scrDim);
    scrList.getViewport().add(list, null);
    list.setModel(listModel);

    JPanel btnPanel = new JPanel();
    btnPanel.setLayout(new BoxLayout(btnPanel, BoxLayout.Y_AXIS));
    btnPanel.add(Box.createGlue());
    btnPanel.add(btnAdd);
    btnPanel.add(Box.createRigidArea(new Dimension(5, 5)));
    btnPanel.add(btnRem);
    btnPanel.add(Box.createGlue());

    add(scrList, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHEAST,
            GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));

    add(btnPanel, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH,
            GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
}

From source file:org.openmicroscopy.shoola.agents.treeviewer.util.MIFNotificationDialog.java

/** 
 * Builds and lays out the buttons./*from   w  w w . j ava2  s  .  c om*/
 * 
 * @return See above.
 */
private JPanel buildToolBar() {
    JPanel bar = new JPanel();
    if (ImageCheckerType.CHGRP.equals(index)) {
        bar.add(moveButton);
        bar.add(Box.createRigidArea(UIUtilities.H_SPACER_SIZE));
    }
    bar.add(closeButton);
    bar.add(Box.createRigidArea(UIUtilities.H_SPACER_SIZE));
    return UIUtilities.buildComponentPanelRight(bar);
}

From source file:hr.fer.zemris.vhdllab.platform.gui.dialog.save.SaveDialog.java

public SaveDialog(LocalizationSource source, SaveContext context) {
    super(source);
    Validate.notNull(context, "Save variant can't be null");
    // setup label
    JLabel label = new JLabel(getMainMessage(source, context));
    int width = DIALOG_WIDTH - 2 * BORDER;
    int height = LABEL_HEIGHT - 2 * BORDER;
    label.setPreferredSize(new Dimension(width, height));
    label.setBorder(BorderFactory.createEmptyBorder(BORDER, BORDER, BORDER, BORDER));

    // setup check box list
    list = new CheckBoxList();
    width = DIALOG_WIDTH - 2 * BORDER;/*w ww  .  ja  va 2 s.  c  o  m*/
    height = 0; // because list is a center component and it doesnt need
    // height
    list.setPreferredSize(new Dimension(width, height));
    list.setBorder(BorderFactory.createEmptyBorder(BORDER, BORDER, BORDER, BORDER));

    // setup select all and deselect all buttons
    JButton selectAll = new JButton(source.getMessage(SELECT_ALL_MESSAGE));
    selectAll.setPreferredSize(new Dimension(BUTTON_WIDTH, BUTTON_HEIGHT));
    selectAll.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            list.setSelectionToAll(true);
        }
    });

    JButton deselectAll = new JButton(source.getMessage(DESELECT_ALL_MESSAGE));
    deselectAll.setPreferredSize(new Dimension(BUTTON_WIDTH, BUTTON_HEIGHT));
    deselectAll.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            list.setSelectionToAll(false);
        }
    });

    Box selectBox = Box.createHorizontalBox();
    selectBox.add(selectAll);
    selectBox.add(Box.createRigidArea(new Dimension(BORDER, BUTTON_HEIGHT)));
    selectBox.add(deselectAll);
    selectBox.setBorder(BorderFactory.createEmptyBorder(0, 0, BORDER, 0));

    // setup ok and cancel buttons
    JButton ok = new JButton(source.getMessage(OK_MESSAGE));
    ok.setPreferredSize(new Dimension(BUTTON_WIDTH, BUTTON_HEIGHT));
    ok.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            closeDialog(new ArrayList<File>());
        }
    });

    JButton cancel = new JButton(source.getMessage(CANCEL_MESSAGE));
    cancel.setPreferredSize(new Dimension(BUTTON_WIDTH, BUTTON_HEIGHT));
    cancel.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            closeDialog(null);
        }
    });

    Box actionBox = Box.createHorizontalBox();
    actionBox.add(ok);
    actionBox.add(Box.createRigidArea(new Dimension(BORDER, BUTTON_HEIGHT)));
    actionBox.add(cancel);
    actionBox.setBorder(BorderFactory.createEmptyBorder(BORDER, 0, BORDER, 0));

    JPanel selectPanel = new JPanel(new BorderLayout());
    selectPanel.add(selectBox, BorderLayout.EAST);
    JPanel actionPanel = new JPanel(new BorderLayout());
    actionPanel.add(actionBox, BorderLayout.EAST);

    JCheckBox alwaysSave = new JCheckBox(source.getMessage(ALWAYS_SAVE_MESSAGE));
    alwaysSave.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            JCheckBox checkBox = (JCheckBox) e.getSource();
            Preferences preferences = Preferences.userNodeForPackage(SaveDialog.class);
            preferences.putBoolean(SHOULD_AUTO_SAVE, checkBox.isSelected());
        }
    });
    alwaysSave.setSelected(false);
    JPanel alwaysSavePanel = new JPanel(new BorderLayout());
    alwaysSavePanel.add(alwaysSave, BorderLayout.WEST);

    JPanel lowerPanel = new JPanel(new BorderLayout());
    lowerPanel.add(selectPanel, BorderLayout.NORTH);
    lowerPanel.add(alwaysSavePanel, BorderLayout.CENTER);
    lowerPanel.add(actionPanel, BorderLayout.SOUTH);

    this.setLayout(new BorderLayout());
    JPanel messagePanel = new JPanel(new BorderLayout());
    messagePanel.add(label, BorderLayout.NORTH);
    messagePanel.add(list, BorderLayout.CENTER);
    messagePanel.add(lowerPanel, BorderLayout.SOUTH);
    this.getContentPane().add(messagePanel, BorderLayout.CENTER);
    this.getRootPane().setDefaultButton(ok);
    this.setPreferredSize(new Dimension(DIALOG_WIDTH, DIALOG_HEIGHT));
    this.setTitle(getTitle(source, context));
}

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

private void initBaseDirPanel(SwingConfig config, ComponentRepository componentRepository) {

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

    JLabel labelBaseDir = new JLabel(config.getLocalizer().localize("label.base-directory"));
    labelBaseDir.setAlignmentX(Component.LEFT_ALIGNMENT);
    this.add(labelBaseDir);

    baseDirPathTextField/*from w w w .  j  av a  2 s.  co  m*/
            .setPreferredSize(new Dimension(SwingConfig.COMPONENT_WIDTH, config.getStandardComponentHight()));
    baseDirPathTextField
            .setMaximumSize(new Dimension(SwingConfig.COMPONENT_WIDTH_MAX, config.getStandardComponentHight()));
    // baseDirPathTextField.setText( dataModel.getBaseDirectory().getPath() );
    baseDirPathTextField.addItem(dataModel.getBaseDirectory().getPath());
    baseDirPathTextField.setSelectedItem(dataModel.getBaseDirectory().getPath());
    baseDirPathTextField.setToolTipText(dataModel.getBaseDirectory().getPath());
    baseDirPathTextField.setEditable(false);
    baseDirPathTextField.addItemListener(new BaseDirectoryComboBoxListener(config, dataModel));

    JButton openBaseDirFileChooserButton = new JButton(localizer.localize("button.browse"));
    openBaseDirFileChooserButton.requestFocusInWindow();
    class BaseDirectoryRepository extends AbstractFileRepository {
        public BaseDirectoryRepository(FARConfig cfg, ComponentRepository repository) {
            super(cfg, repository.getFindForm(), repository.getReplaceForm(), repository.getMessageBox());
        }

        public File getFile() {
            return farconfig.getBaseDirectory();
        }

        public boolean setFile(File file) {
            if (isSubdirectory(replaceForm.getBackupDirectory(), file)) {
                messageBox.error(localizer.localize("message.nested-base-child"));
                return false;
            } else if (isSubdirectory(file, replaceForm.getBackupDirectory())) {
                messageBox.error(localizer.localize("message.nested-base-parent"));
                return false;
            } else {
                baseDirPathTextField.addItem(file.getPath());
                baseDirPathTextField.setSelectedItem(file.getPath());
                baseDirPathTextField.setToolTipText(file.getPath());
                farconfig.setBaseDirectory(file);
                findForm.setBaseDirectory(file);
                return true;
            }
        }
    }
    browseButtonListener = new FindFilePanelBrowseButtonListener(baseDirPathTextField,
            new BaseDirectoryRepository(config, componentRepository),
            localizer.localize("label.choose-base-directory"), componentRepository.getFindCommand(),
            componentRepository.getResetDispatcher());
    browseButtonListener.addActionListener(componentRepository.getSearchBaseListener());
    openBaseDirFileChooserButton.addActionListener(browseButtonListener);
    TwoComponentsPanel lineBaseDir = new TwoComponentsPanel(baseDirPathTextField, openBaseDirFileChooserButton);
    lineBaseDir.setAlignmentX(Component.LEFT_ALIGNMENT);
    this.add(lineBaseDir);

    subdirFlag = new JCheckBox(localizer.localize("label.include-subdir") + ":");
    subdirFlag.setSelected(dataModel.isIncludeSubDirs());
    subdirFlag.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent event) {
            dataModel.setIncludeSubDirs((ItemEvent.SELECTED == event.getStateChange()));
            if (ItemEvent.SELECTED != event.getStateChange())
                subdirButton.reset();
        }
    });
    subdirFlag.addItemListener(componentRepository.getSearchBaseListener());
    componentRepository.getResetDispatcher().addToBeSelected(subdirFlag);
    browseButtonListener.setSubdirCheckBox(subdirFlag);
    subdirButton = new SubdirPatternLink(dataModel, localizer, componentRepository.getSearchBaseListener(),
            componentRepository.getRootWindow());
    componentRepository.getResetDispatcher().addResetable(subdirButton);
    TwoComponentsPanel subdirpanel = new TwoComponentsPanel(subdirFlag, subdirButton);
    subdirpanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    this.add(subdirpanel);

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

From source file:net.pandoragames.far.ui.swing.dialog.SettingsDialog.java

private void init() {
    this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    this.setLayout(new BoxLayout(this.getContentPane(), BoxLayout.Y_AXIS));
    this.setResizable(false);

    JPanel basePanel = new JPanel();
    basePanel.setLayout(new BoxLayout(basePanel, BoxLayout.Y_AXIS));
    basePanel.setBorder(/*from w w w  . ja va  2 s . co  m*/
            BorderFactory.createEmptyBorder(0, SwingConfig.PADDING, SwingConfig.PADDING, SwingConfig.PADDING));
    registerCloseWindowKeyListener(basePanel);

    // sink for error messages
    MessageLabel errorField = new MessageLabel();
    errorField.setMinimumSize(new Dimension(100, swingConfig.getStandardComponentHight()));
    errorField.setBorder(BorderFactory.createEmptyBorder(1, SwingConfig.PADDING, 2, SwingConfig.PADDING));
    TwoComponentsPanel lineError = new TwoComponentsPanel(errorField,
            Box.createRigidArea(new Dimension(1, swingConfig.getStandardComponentHight())));
    lineError.setAlignmentX(Component.LEFT_ALIGNMENT);
    basePanel.add(lineError);

    // character set
    JLabel labelCharset = new JLabel(swingConfig.getLocalizer().localize("label.default-characterset"));
    labelCharset.setAlignmentX(Component.LEFT_ALIGNMENT);
    basePanel.add(labelCharset);

    JComboBox listCharset = new JComboBox(swingConfig.getCharsetList().toArray());
    listCharset.setAlignmentX(Component.LEFT_ALIGNMENT);
    listCharset.setSelectedItem(swingConfig.getDefaultCharset());
    listCharset.setEditable(true);
    listCharset.setMaximumSize(
            new Dimension(SwingConfig.COMPONENT_WIDTH_MAX, swingConfig.getStandardComponentHight()));

    listCharset.addActionListener(new CharacterSetListener(errorField));
    listCharset.setEditor(new CharacterSetEditor(errorField));
    basePanel.add(listCharset);

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

    // select the group selector
    JPanel selectorPanel = new JPanel();
    selectorPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
    selectorPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    // linePattern.setAlignmentX( Component.LEFT_ALIGNMENT );
    JLabel labelSelector = new JLabel(swingConfig.getLocalizer().localize("label.group-ref-indicator"));
    selectorPanel.add(labelSelector);
    JComboBox selectorBox = new JComboBox(FARConfig.GROUPREFINDICATORLIST);
    selectorBox.setSelectedItem(Character.toString(groupReference));
    selectorBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            JComboBox cbox = (JComboBox) event.getSource();
            String indicator = (String) cbox.getSelectedItem();
            groupReference = indicator.charAt(0);
        }
    });
    selectorPanel.add(selectorBox);
    basePanel.add(selectorPanel);

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

    // checkbox DO BACKUP
    JCheckBox doBackupFlag = new JCheckBox(swingConfig.getLocalizer().localize("label.create-backup"));
    doBackupFlag.setAlignmentX(Component.LEFT_ALIGNMENT);
    doBackupFlag.setHorizontalTextPosition(SwingConstants.LEADING);
    doBackupFlag.setSelected(replaceForm.isDoBackup());
    doBackupFlag.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent event) {
            doBackup = ItemEvent.SELECTED == event.getStateChange();
            backupFlagEvent = event;
        }
    });
    basePanel.add(doBackupFlag);

    JTextField backupDirPathTextField = new JTextField();
    backupDirPathTextField.setPreferredSize(
            new Dimension(SwingConfig.COMPONENT_WIDTH, swingConfig.getStandardComponentHight()));
    backupDirPathTextField.setMaximumSize(
            new Dimension(SwingConfig.COMPONENT_WIDTH_MAX, swingConfig.getStandardComponentHight()));
    backupDirPathTextField.setText(backupDirectory.getPath());
    backupDirPathTextField.setToolTipText(backupDirectory.getPath());
    backupDirPathTextField.setEditable(false);
    JButton openBaseDirFileChooserButton = new JButton(swingConfig.getLocalizer().localize("button.browse"));
    BrowseButtonListener backupDirButtonListener = new BrowseButtonListener(backupDirPathTextField,
            new BackUpDirectoryRepository(swingConfig, findForm, replaceForm, errorField),
            swingConfig.getLocalizer().localize("label.choose-backup-directory"));
    openBaseDirFileChooserButton.addActionListener(backupDirButtonListener);
    TwoComponentsPanel lineBaseDir = new TwoComponentsPanel(backupDirPathTextField,
            openBaseDirFileChooserButton);
    lineBaseDir.setAlignmentX(Component.LEFT_ALIGNMENT);
    basePanel.add(lineBaseDir);

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

    JPanel fileInfoPanel = new JPanel();
    fileInfoPanel
            .setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(EtchedBorder.LOWERED),
                    swingConfig.getLocalizer().localize("label.default-file-info")));
    fileInfoPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    fileInfoPanel.setLayout(new BoxLayout(fileInfoPanel, BoxLayout.Y_AXIS));
    JLabel fileInfoLabel = new JLabel(swingConfig.getLocalizer().localize("message.displayed-in-info-column"));
    fileInfoLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
    fileInfoPanel.add(fileInfoLabel);
    fileInfoPanel.add(Box.createHorizontalGlue());
    JRadioButton nothingRadio = new JRadioButton(swingConfig.getLocalizer().localize("label.nothing"));
    nothingRadio.setAlignmentX(Component.LEFT_ALIGNMENT);
    nothingRadio.setActionCommand(SwingConfig.DefaultFileInfo.NOTHING.name());
    nothingRadio.setSelected(swingConfig.getDefaultFileInfo() == SwingConfig.DefaultFileInfo.NOTHING);
    fileInfoOptions.add(nothingRadio);
    fileInfoPanel.add(nothingRadio);
    JRadioButton readOnlyRadio = new JRadioButton(
            swingConfig.getLocalizer().localize("label.read-only-warning"));
    readOnlyRadio.setAlignmentX(Component.LEFT_ALIGNMENT);
    readOnlyRadio.setActionCommand(SwingConfig.DefaultFileInfo.READONLY.name());
    readOnlyRadio.setSelected(swingConfig.getDefaultFileInfo() == SwingConfig.DefaultFileInfo.READONLY);
    fileInfoOptions.add(readOnlyRadio);
    fileInfoPanel.add(readOnlyRadio);
    JRadioButton sizeRadio = new JRadioButton(swingConfig.getLocalizer().localize("label.filesize"));
    sizeRadio.setAlignmentX(Component.LEFT_ALIGNMENT);
    sizeRadio.setActionCommand(SwingConfig.DefaultFileInfo.SIZE.name());
    sizeRadio.setSelected(swingConfig.getDefaultFileInfo() == SwingConfig.DefaultFileInfo.SIZE);
    fileInfoOptions.add(sizeRadio);
    fileInfoPanel.add(sizeRadio);
    JCheckBox showPlainBytesFlag = new JCheckBox(
            "  " + swingConfig.getLocalizer().localize("label.show-plain-bytes"));
    showPlainBytesFlag.setAlignmentX(Component.LEFT_ALIGNMENT);
    showPlainBytesFlag.setHorizontalTextPosition(SwingConstants.LEADING);
    showPlainBytesFlag.setSelected(swingConfig.isShowPlainBytes());
    showPlainBytesFlag.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent event) {
            showBytes = ItemEvent.SELECTED == event.getStateChange();
        }
    });
    fileInfoPanel.add(showPlainBytesFlag);
    JRadioButton lastModifiedRadio = new JRadioButton(
            swingConfig.getLocalizer().localize("label.last-modified"));
    lastModifiedRadio.setAlignmentX(Component.LEFT_ALIGNMENT);
    lastModifiedRadio.setActionCommand(SwingConfig.DefaultFileInfo.LAST_MODIFIED.name());
    lastModifiedRadio
            .setSelected(swingConfig.getDefaultFileInfo() == SwingConfig.DefaultFileInfo.LAST_MODIFIED);
    fileInfoOptions.add(lastModifiedRadio);
    fileInfoPanel.add(lastModifiedRadio);
    basePanel.add(fileInfoPanel);

    // buttons
    JPanel buttonPannel = new JPanel();
    buttonPannel.setAlignmentX(Component.LEFT_ALIGNMENT);
    buttonPannel.setLayout(new FlowLayout(FlowLayout.TRAILING));
    // cancel
    JButton cancelButton = new JButton(swingConfig.getLocalizer().localize("button.cancel"));
    cancelButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            SettingsDialog.this.dispose();
        }
    });
    buttonPannel.add(cancelButton);
    // save
    JButton saveButton = new JButton(swingConfig.getLocalizer().localize("button.save"));
    saveButton.addActionListener(new SaveButtonListener());
    buttonPannel.add(saveButton);
    this.getRootPane().setDefaultButton(saveButton);

    this.add(basePanel);
    this.add(buttonPannel);
    placeOnScreen(swingConfig.getScreenCenter());
}

From source file:pipeline.parameter_cell_views.FloatRangeSlider.java

public FloatRangeSlider() {
    super();/*from ww w.  jav  a 2 s  .c  o  m*/
    addMouseWheelListener(e -> {

        int rotation = e.getWheelRotation();

        float[] float_values = (float[]) (currentParameter.getValue());
        currentValue0 = float_values[0];
        currentValue1 = float_values[1];
        minimum = float_values[2];
        maximum = float_values[3];

        float change = (currentValue1 - currentValue0 + 1) * rotation * Utils.getMouseWheelClickFactor();

        currentValue0 += change;
        currentValue1 += change;

        if (!((e.getModifiers() & java.awt.event.InputEvent.ALT_MASK) > 0)) {
            if (currentValue1 > maximum) {
                float difference = currentValue1 - currentValue0;
                currentValue1 = maximum;
                currentValue0 = currentValue1 - difference;
            }
            if (currentValue0 < minimum) {
                float difference = currentValue1 - currentValue0;
                currentValue0 = minimum;
                currentValue1 = currentValue0 + difference;
            }
        }

        currentParameter.setValue(new float[] { currentValue0, currentValue1, minimum, maximum });

        readInValuesFromParameter();
        updateDisplays();
        currentParameter.fireValueChanged(false, false, true);
    });
    nf.setGroupingUsed(true);
    nf.setMaximumFractionDigits(5);
    nf.setMaximumIntegerDigits(10);

    setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.BOTH;

    c.gridx = 0;
    c.gridy = 0;
    c.weighty = 1.0;
    c.weightx = 1.0;
    c.gridwidth = 4;

    cForHistogram = (GridBagConstraints) c.clone();

    panelForHistogram = new JPanel();
    panelForHistogram.setPreferredSize(new Dimension(200, 150));
    panelForHistogram.setLayout(new BorderLayout());

    c.gridx = 0;
    c.gridy = 1;// 1
    c.weighty = 0.0;
    c.weightx = 0.0;
    c.gridwidth = 4;
    add(Box.createRigidArea(new Dimension(0, 5)), c);

    slider = new RangeSlider(0, 20);
    slider.addChangeListener(new sliderListener());
    c.gridx = 0;
    c.gridy = 2;
    c.weighty = 0.0;
    c.weightx = 0.0;
    c.gridwidth = 4;
    add(slider, c);

    c.gridx = 0;
    c.gridy = 3;
    c.weighty = 0.0;
    c.weightx = 1.0;
    c.gridwidth = 4;
    Component comp = Box.createRigidArea(new Dimension(0, 10));
    ((JComponent) comp).setOpaque(true);
    add(comp, c);
    c.gridwidth = 1;

    final textBoxListener minMaxListener = new textBoxListener();

    currentTextValue0 = new JTextField("");
    currentTextValue1 = new JTextField("");
    currentTextValue0.addActionListener(new textBoxListenerTriggersUpdate());
    currentTextValue1.addActionListener(new textBoxListenerTriggersUpdate());
    Font smallerFont = new Font(currentTextValue0.getFont().getName(), currentTextValue0.getFont().getStyle(),
            currentTextValue0.getFont().getSize() - 2);
    textMinimum = new JTextField("0");
    textMinimum.setFont(smallerFont);
    textMinimum.addActionListener(minMaxListener);
    textMaximum = new JTextField("50");
    textMaximum.setFont(smallerFont);
    textMaximum.addActionListener(minMaxListener);
    textMaximum.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent e) {
            minMaxListener.actionPerformed(new ActionEvent(textMaximum, 0, ""));
        }
    });
    textMinimum.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent e) {
            minMaxListener.actionPerformed(new ActionEvent(textMinimum, 0, ""));
        }
    });

    textValueFrame = new JPanel();
    textValueFrame.setBackground(getBackground());
    textValueFrame.setLayout(new GridBagLayout());

    c.gridx = 0;
    c.gridy = 0;
    c.weighty = 1.0;
    c.weightx = 0.1;
    textValueFrame.add(textMinimum, c);

    c.gridx = 1;
    c.gridy = 0;
    c.weighty = 1.0;
    c.weightx = 0.3;
    textValueFrame.add(currentTextValue0, c);

    c.gridx = 2;
    c.gridy = 0;
    c.weighty = 1.0;
    c.weightx = 0.3;
    textValueFrame.add(currentTextValue1, c);

    c.gridx = 3;
    c.gridy = 0;
    c.weighty = 1.0;
    c.weightx = 0.1;
    textValueFrame.add(textMaximum, c);

    c.gridx = 0;
    c.gridy = 4;
    c.weighty = 0.0;
    c.weightx = 0.3;
    c.gridwidth = 4;
    add(textValueFrame, c);
    c.gridwidth = 1;

    parameterName = new JLabel("parameter");
    c.gridx = 0;
    c.gridy = 5;
    c.weighty = 0.0;
    c.weightx = 0.01;
    c.gridwidth = 1;
    add(parameterName, c);

    resetMin = new JButton("Min");
    resetMin.setActionCommand("Reset Min");
    resetMin.addActionListener(new buttonListener());
    resetMax = new JButton("Max");
    resetMax.setActionCommand("Reset Max");
    resetMax.addActionListener(new buttonListener());
    resetRange = new JButton("MinMax");
    resetRange.setActionCommand("Reset Range");
    resetRange.addActionListener(new buttonListener());

    c.gridx = 1;
    c.gridy = 5;
    c.weighty = 0.0;
    c.weightx = 0.2;
    c.gridwidth = 1;
    add(resetMin, c);

    c.gridx = 2;
    c.gridy = 5;
    c.weighty = 0.0;
    c.weightx = 0.2;
    c.gridwidth = 1;
    add(resetMax, c);

    c.gridx = 3;
    c.gridy = 5;
    c.weighty = 0.0;
    c.weightx = 0.2;
    c.gridwidth = 1;
    add(resetRange, c);
    // ,resetMax,resetRange;

}

From source file:org.jcurl.demo.editor.EditorApp.java

public EditorApp() {
    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            EditorApp.this.cmdExit();
        }//  ww  w  .  j a  v  a 2 s.c om
    });
    master = new RockEditDisplay();
    master.setPos(mod_locations);
    master.setSpeed(mod_speeds);
    final PositionDisplay pnl2 = new PositionDisplay();
    pnl2.setPos(mod_locations);
    pnl2.setZoom(Zoomer.HOG2HACK);

    final Container con = getContentPane();

    con.add(master, "Center");
    con.add(new SumWaitDisplay(mod_locations), "West");
    con.add(new SumShotDisplay(mod_locations), "East");
    {
        final Box b0 = Box.createVerticalBox();
        final Box b1 = Box.createHorizontalBox();
        b1.add(Box.createRigidArea(new Dimension(0, 75)));
        b1.add(pnl2);
        b0.add(b1);
        b0.add(new JSlider(0, 100, 0));
        final Box b2 = Box.createHorizontalBox();
        b2.add(Box.createHorizontalGlue());
        b2.add(bStart = this.newButton("Start", this, "cmdRunStart"));
        b2.add(bPause = this.newButton("Pause", this, "cmdRunPause"));
        b2.add(bStop = this.newButton("Stop", this, "cmdRunStop"));
        b2.add(Box.createHorizontalGlue());
        b0.add(b2);
        con.add(b0, "South");
    }
    bStop.getAction().actionPerformed(null);

    setJMenuBar(createMenu());
    refreshTitle();
    this.setSize(900, 400);

    new SpeedController(mod_locations, mod_speeds, master);
    new LocationController(mod_locations, pnl2);
    lastSaved = mod_locations.getLastChanged();
}

From source file:e3fraud.gui.MainWindow.java

public MainWindow() {
    super(new BorderLayout(5, 5));

    extended = false;//www .j a v  a2s .c  o m

    //Create the log first, because the action listeners
    //need to refer to it.
    log = new JTextArea(10, 50);
    log.setMargin(new Insets(5, 5, 5, 5));
    log.setEditable(false);
    logScrollPane = new JScrollPane(log);
    DefaultCaret caret = (DefaultCaret) log.getCaret();
    caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);

    //        create the progress bar
    progressBar = new JProgressBar(0, 100);
    progressBar.setValue(progressBar.getMinimum());
    progressBar.setVisible(false);
    progressBar.setStringPainted(true);
    //Create the settings pane
    generationSettingLabel = new JLabel("Generate:");
    SpinnerModel collusionsSpinnerModel = new SpinnerNumberModel(1, 0, 3, 1);
    collusionSettingsPanel = new JPanel(new FlowLayout()) {
        @Override
        public Dimension getMaximumSize() {
            return getPreferredSize();
        }
    };
    // collusionSettingsPanel.setLayout(new BoxLayout(collusionSettingsPanel, BoxLayout.X_AXIS));
    collusionsButton = new JSpinner(collusionsSpinnerModel);
    collusionsLabel = new JLabel("collusion(s)");
    collusionSettingsPanel.add(collusionsButton);
    collusionSettingsPanel.add(collusionsLabel);

    rankingSettingLabel = new JLabel("Rank by:");
    lossButton = new JRadioButton("loss");
    lossButton.setToolTipText("Sort sub-ideal models based on loss for Target of Assessment (high -> low)");
    gainButton = new JRadioButton("gain");
    gainButton.setToolTipText(
            "Sort sub-ideal models based on gain of any actor except Target of Assessment (high -> low)");
    lossGainButton = new JRadioButton("loss + gain");
    lossGainButton.setToolTipText(
            "Sort sub-ideal models based on loss for Target of Assessment and, if equal, on gain of any actor except Target of Assessment");
    //gainLossButton = new JRadioButton("gain + loss");
    lossGainButton.setSelected(true);
    rankingGroup = new ButtonGroup();
    rankingGroup.add(lossButton);
    rankingGroup.add(gainButton);
    rankingGroup.add(lossGainButton);
    //rankingGroup.add(gainLossButton);
    groupingSettingLabel = new JLabel("Group by:");
    groupingButton = new JCheckBox("collusion");
    groupingButton.setToolTipText(
            "Groups sub-ideal models based on the pair of actors colluding before ranking them");
    groupingButton.setSelected(false);
    refreshButton = new JButton("Refresh");
    refreshButton.addActionListener(this);

    settingsPanel = new JPanel();
    settingsPanel.setLayout(new BoxLayout(settingsPanel, BoxLayout.PAGE_AXIS));
    settingsPanel.add(Box.createRigidArea(new Dimension(0, 5)));
    settingsPanel.add(generationSettingLabel);
    collusionSettingsPanel.setAlignmentX(LEFT_ALIGNMENT);
    settingsPanel.add(Box.createRigidArea(new Dimension(0, 5)));
    settingsPanel.add(collusionSettingsPanel);
    settingsPanel.add(Box.createRigidArea(new Dimension(0, 5)));
    rankingSettingLabel.setAlignmentY(TOP_ALIGNMENT);
    settingsPanel.add(rankingSettingLabel);
    settingsPanel.add(lossButton);
    settingsPanel.add(gainButton);
    settingsPanel.add(lossGainButton);
    //settingsPanel.add(gainLossButton);
    settingsPanel.add(Box.createRigidArea(new Dimension(0, 5)));
    settingsPanel.add(groupingSettingLabel);
    settingsPanel.add(groupingButton);
    settingsPanel.add(Box.createRigidArea(new Dimension(0, 5)));
    settingsPanel.add(refreshButton);
    settingsPanel.add(Box.createRigidArea(new Dimension(0, 20)));
    progressBar.setPreferredSize(
            new Dimension(settingsPanel.getSize().width, progressBar.getPreferredSize().height));
    settingsPanel.add(progressBar);

    //Create the result tree
    root = new DefaultMutableTreeNode("No models to display");
    treeModel = new DefaultTreeModel(root);
    tree = new JTree(treeModel);
    //tree.setUI(new CustomTreeUI());
    tree.setCellRenderer(new CustomTreeCellRenderer(tree));
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    tree.setLargeModel(true);
    resultScrollPane = new JScrollPane(tree);
    tree.addTreeSelectionListener(treeSelectionListener);

    //tree.setShowsRootHandles(true);
    //Create a file chooser for saving
    sfc = new JFileChooser();
    FileFilter jpegFilter = new FileNameExtensionFilter("JPEG image", new String[] { "jpg", "jpeg" });
    sfc.addChoosableFileFilter(jpegFilter);
    sfc.setFileFilter(jpegFilter);

    //Create a file chooser for loading
    fc = new JFileChooser();
    FileFilter rdfFilter = new FileNameExtensionFilter("RDF file", "RDF");
    fc.addChoosableFileFilter(rdfFilter);
    fc.setFileFilter(rdfFilter);

    //Create the open button.  
    openButton = new JButton("Load model", createImageIcon("images/Open24.png"));
    openButton.addActionListener(this);
    openButton.setToolTipText("Load a e3value model");

    //Create the ideal graph button. 
    idealGraphButton = new JButton("Show ideal graph", createImageIcon("images/Plot.png"));
    idealGraphButton.setToolTipText("Display ideal profitability graph");
    idealGraphButton.addActionListener(this);

    Dimension thinButtonDimension = new Dimension(15, 420);

    //Create the expand subideal graph button. 
    expandButton = new JButton(">");
    expandButton.setPreferredSize(thinButtonDimension);
    expandButton.setMargin(new Insets(0, 0, 0, 0));
    expandButton.setToolTipText("Expand to show non-ideal profitability graph for selected model");
    expandButton.addActionListener(this);

    //Create the collapse sub-ideal graph button. 
    collapseButton = new JButton("<");
    collapseButton.setPreferredSize(thinButtonDimension);
    collapseButton.setMargin(new Insets(0, 0, 0, 0));
    collapseButton.setToolTipText("Collapse non-ideal profitability graph for selected model");
    collapseButton.addActionListener(this);

    //Create the generation button. 
    generateButton = new JButton("Generate sub-ideal models", createImageIcon("images/generate.png"));
    generateButton.addActionListener(this);
    generateButton.setToolTipText("Generate sub-ideal models for the e3value model currently loaded");

    //Create the chart panel
    chartPane = new JPanel();
    chartPane.setLayout(new FlowLayout(FlowLayout.LEFT));
    chartPane.add(expandButton);

    //For layout purposes, put the buttons in a separate panel
    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
    buttonPanel.add(openButton);
    buttonPanel.add(Box.createRigidArea(new Dimension(20, 0)));
    buttonPanel.add(generateButton);
    buttonPanel.add(Box.createRigidArea(new Dimension(10, 0)));
    buttonPanel.add(idealGraphButton);

    //Add the buttons, the ranking options, the result list and the log to this panel.
    add(buttonPanel, BorderLayout.PAGE_START);
    add(settingsPanel, BorderLayout.LINE_START);
    add(resultScrollPane, BorderLayout.CENTER);

    add(logScrollPane, BorderLayout.PAGE_END);
    add(chartPane, BorderLayout.LINE_END);
    //and make a nice border around it
    setBorder(BorderFactory.createEmptyBorder(5, 10, 10, 10));
}

From source file:com.xmage.launcher.XMageLauncher.java

private XMageLauncher() {
    locale = Locale.getDefault();
    //locale = new Locale("it", "IT");
    messages = ResourceBundle.getBundle("MessagesBundle", locale);
    localize();/*from w  w  w.  j a  v a  2 s. com*/

    serverConsole = new XMageConsole("XMage Server console");
    clientConsole = new XMageConsole("XMage Client console");

    frame = new JFrame(messages.getString("frameTitle") + " " + Config.getVersion());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setPreferredSize(new Dimension(800, 500));
    frame.setResizable(false);

    createToolbar();

    ImageIcon icon = new ImageIcon(XMageLauncher.class.getResource("/icon-mage-flashed.png"));
    frame.setIconImage(icon.getImage());

    Random r = new Random();
    int imageNum = 1 + r.nextInt(17);
    ImageIcon background = new ImageIcon(new ImageIcon(
            XMageLauncher.class.getResource("/backgrounds/" + Integer.toString(imageNum) + ".jpg")).getImage()
                    .getScaledInstance(800, 480, Image.SCALE_SMOOTH));
    mainPanel = new JLabel(background) {
        @Override
        public Dimension getPreferredSize() {
            Dimension size = super.getPreferredSize();
            Dimension lmPrefSize = getLayout().preferredLayoutSize(this);
            size.width = Math.max(size.width, lmPrefSize.width);
            size.height = Math.max(size.height, lmPrefSize.height);
            return size;
        }
    };
    mainPanel.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent e) {
            grabPoint = e.getPoint();
            mainPanel.getComponentAt(grabPoint);
        }
    });
    mainPanel.addMouseMotionListener(new MouseMotionAdapter() {
        @Override
        public void mouseDragged(MouseEvent e) {

            // get location of Window
            int thisX = frame.getLocation().x;
            int thisY = frame.getLocation().y;

            // Determine how much the mouse moved since the initial click
            int xMoved = (thisX + e.getX()) - (thisX + grabPoint.x);
            int yMoved = (thisY + e.getY()) - (thisY + grabPoint.y);

            // Move window to this position
            int X = thisX + xMoved;
            int Y = thisY + yMoved;
            frame.setLocation(X, Y);
        }
    });
    mainPanel.setLayout(new GridBagLayout());

    GridBagConstraints constraints = new GridBagConstraints();
    constraints.insets = new Insets(10, 10, 10, 10);

    Font font16 = new Font("Arial", Font.BOLD, 16);
    Font font12 = new Font("Arial", Font.PLAIN, 12);
    Font font12b = new Font("Arial", Font.BOLD, 12);

    mainPanel.add(Box.createRigidArea(new Dimension(250, 50)));

    ImageIcon logo = new ImageIcon(new ImageIcon(XMageLauncher.class.getResource("/label-xmage.png")).getImage()
            .getScaledInstance(150, 75, Image.SCALE_SMOOTH));
    xmageLogo = new JLabel(logo);
    constraints.gridx = 3;
    constraints.gridy = 0;
    constraints.gridheight = 1;
    constraints.gridwidth = GridBagConstraints.REMAINDER;
    constraints.anchor = GridBagConstraints.EAST;
    mainPanel.add(xmageLogo, constraints);

    textArea = new JTextArea(5, 40);
    textArea.setEditable(false);
    textArea.setForeground(Color.WHITE);
    textArea.setBackground(Color.BLACK);
    DefaultCaret caret = (DefaultCaret) textArea.getCaret();
    caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);
    scrollPane = new JScrollPane(textArea);
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    constraints.gridx = 2;
    constraints.gridy = 1;
    constraints.weightx = 1.0;
    constraints.weighty = 1.0;
    constraints.fill = GridBagConstraints.BOTH;
    mainPanel.add(scrollPane, constraints);

    labelProgress = new JLabel(messages.getString("progress"));
    labelProgress.setFont(font12);
    labelProgress.setForeground(Color.WHITE);
    constraints.gridy = 2;
    constraints.weightx = 0.0;
    constraints.weighty = 0.0;
    constraints.gridwidth = 1;
    constraints.anchor = GridBagConstraints.WEST;
    mainPanel.add(labelProgress, constraints);

    progressBar = new JProgressBar(0, 100);
    constraints.gridx = 3;
    constraints.weightx = 1.0;
    constraints.gridwidth = GridBagConstraints.REMAINDER;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    mainPanel.add(progressBar, constraints);

    JPanel pnlButtons = new JPanel();
    pnlButtons.setLayout(new GridBagLayout());
    pnlButtons.setOpaque(false);
    constraints.gridx = 0;
    constraints.gridy = 3;
    constraints.gridheight = GridBagConstraints.REMAINDER;
    constraints.fill = GridBagConstraints.BOTH;
    mainPanel.add(pnlButtons, constraints);

    btnLaunchClient = new JButton(messages.getString("launchClient"));
    btnLaunchClient.setToolTipText(messages.getString("launchClient.tooltip"));
    btnLaunchClient.setFont(font16);
    btnLaunchClient.setForeground(Color.GRAY);
    btnLaunchClient.setEnabled(false);
    btnLaunchClient.setPreferredSize(new Dimension(180, 60));
    btnLaunchClient.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            handleClient();
        }
    });

    constraints.gridx = GridBagConstraints.RELATIVE;
    constraints.gridy = 0;
    constraints.gridwidth = 1;
    constraints.fill = GridBagConstraints.BOTH;
    pnlButtons.add(btnLaunchClient, constraints);

    btnLaunchClientServer = new JButton(messages.getString("launchClientServer"));
    btnLaunchClientServer.setToolTipText(messages.getString("launchClientServer.tooltip"));
    btnLaunchClientServer.setFont(font12b);
    btnLaunchClientServer.setEnabled(false);
    btnLaunchClientServer.setForeground(Color.GRAY);
    btnLaunchClientServer.setPreferredSize(new Dimension(80, 40));
    btnLaunchClientServer.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            handleServer();
            handleClient();
        }
    });

    constraints.fill = GridBagConstraints.HORIZONTAL;
    pnlButtons.add(btnLaunchClientServer, constraints);

    btnLaunchServer = new JButton(messages.getString("launchServer"));
    btnLaunchServer.setToolTipText(messages.getString("launchServer.tooltip"));
    btnLaunchServer.setFont(font12b);
    btnLaunchServer.setEnabled(false);
    btnLaunchServer.setForeground(Color.GRAY);
    btnLaunchServer.setPreferredSize(new Dimension(80, 40));
    btnLaunchServer.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            handleServer();
        }
    });

    pnlButtons.add(btnLaunchServer, constraints);

    btnUpdate = new JButton(messages.getString("update.xmage"));
    btnUpdate.setToolTipText(messages.getString("update.xmage.tooltip"));
    btnUpdate.setFont(font12b);
    btnUpdate.setForeground(Color.BLACK);
    btnUpdate.setPreferredSize(new Dimension(80, 40));
    btnUpdate.setEnabled(true);

    btnUpdate.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            handleUpdate();
        }
    });

    pnlButtons.add(btnUpdate, constraints);

    btnCheck = new JButton(messages.getString("check.xmage"));
    btnCheck.setToolTipText(messages.getString("check.xmage.tooltip"));
    btnCheck.setFont(font12b);
    btnCheck.setForeground(Color.BLACK);
    btnCheck.setPreferredSize(new Dimension(80, 40));
    btnCheck.setEnabled(true);

    btnCheck.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            handleCheckUpdates();
        }
    });

    pnlButtons.add(btnCheck, constraints);

    frame.add(mainPanel);
    frame.pack();
    Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
    frame.setLocation(dim.width / 2 - frame.getSize().width / 2, dim.height / 2 - frame.getSize().height / 2);
}

From source file:org.photovault.swingui.PhotoInfoDlg.java

/**
   Creates the UI components needed for this dialog.
*//*from  ww  w  .  j a va 2 s  . c  o m*/
protected void createUI() {
    Container parentView = getParentController().getView();
    Window wnd = SwingUtilities.getWindowAncestor(parentView);
    dialogWindow = new JDialog((Frame) wnd);
    editor = new PhotoInfoEditor(this);
    addView(editor);
    dialogWindow.getContentPane().add(editor, BorderLayout.NORTH);
    final PhotoInfoDlg staticThis = this;

    registerAction("save_close", new DataAccessAction("OK") {
        public void actionPerformed(ActionEvent actionEvent, org.hibernate.Session currentSession) {
            save();
            dialogWindow.setVisible(false);
        }

    });
    registerAction("discard_close", new DataAccessAction("Cancel") {
        public void actionPerformed(ActionEvent actionEvent, org.hibernate.Session currentSession) {
            discard();
            dialogWindow.setVisible(false);
        }

    });

    JButton okBtn = new JButton(this.getActionAdapter("save_close"));
    //   okBtn.addActionListener( new ActionListener() {
    //            public void actionPerformed( ActionEvent e ) {
    //                try {
    //                    ChangePhotoInfoCommand cmd = ctrl.getChangeCommand();
    //                    masterCtrl.getCommandHandler().executeCommand( cmd );
    //                    photoChanged = true;
    //                    setVisible( false );
    //                } catch ( Exception ex ) {
    //                    JOptionPane.showMessageDialog(
    //                            staticThis,
    //                            "Error while saving changes: \n" + ex.getMessage(),
    //                            "Error saving changes",
    //                            JOptionPane.ERROR_MESSAGE,
    //                            null );
    //                    log.warn( "problem while saving changes: " + ex.getMessage() );
    //                }
    //            }
    //        } );

    JButton applyBtn = new JButton(getActionAdapter("save"));
    //        applyBtn.addActionListener( new ActionListener() {
    //            public void actionPerformed( ActionEvent e ) {
    //                try {
    //                    ChangePhotoInfoCommand cmd = ctrl.getChangeCommand();
    //                    masterCtrl.getCommandHandler().executeCommand( cmd );
    //                    photoChanged = true;
    //                } catch ( Exception ex ) {
    //                    JOptionPane.showMessageDialog(
    //                            staticThis,
    //                            "Error while saving changes: \n" + ex.getMessage(),
    //                            "Error saving changes",
    //                            JOptionPane.ERROR_MESSAGE,
    //                            null );
    //                    log.warn( "problem while saving changes: " + ex.getMessage() );
    //                }
    //            }
    //        } );

    JButton discardBtn = new JButton(getActionAdapter("discard"));
    //        discardBtn.addActionListener( new ActionListener() {
    //            public void actionPerformed( ActionEvent e ) {
    //                ctrl.discard();
    //            }
    //        } );

    JButton closeBtn = new JButton(getActionAdapter("discard_close"));
    //        closeBtn.addActionListener( new ActionListener() {
    //            public void actionPerformed( ActionEvent e ) {
    //                ctrl.discard();
    //                setVisible( false );
    //            }
    //        } );

    JPanel buttonPane = new JPanel();
    buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.X_AXIS));
    buttonPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    buttonPane.add(Box.createHorizontalGlue());
    buttonPane.add(okBtn);
    buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
    buttonPane.add(applyBtn);
    buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
    buttonPane.add(discardBtn);
    buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
    buttonPane.add(closeBtn);
    dialogWindow.getContentPane().add(buttonPane, BorderLayout.SOUTH);

    dialogWindow.getRootPane().setDefaultButton(applyBtn);

    dialogWindow.pack();
}