Example usage for javax.swing BoxLayout X_AXIS

List of usage examples for javax.swing BoxLayout X_AXIS

Introduction

In this page you can find the example usage for javax.swing BoxLayout X_AXIS.

Prototype

int X_AXIS

To view the source code for javax.swing BoxLayout X_AXIS.

Click Source Link

Document

Specifies that components should be laid out left to right.

Usage

From source file:net.sf.mzmine.modules.visualization.ida.IDABottomPanel.java

IDABottomPanel(IDAVisualizerWindow masterFrame, RawDataFile dataFile, ParameterSet parameters) {

    this.dataFile = dataFile;
    this.masterFrame = masterFrame;

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

    setBackground(Color.white);//from   w w w .ja v a 2  s  .  co  m
    setBorder(new EmptyBorder(5, 5, 5, 0));

    add(Box.createHorizontalGlue());

    GUIUtils.addLabel(this, "Show: ", SwingConstants.RIGHT);

    thresholdCombo = new JComboBox<Object>(PeakThresholdMode.values());
    thresholdCombo.setSelectedItem(PeakThresholdMode.NONE);
    thresholdCombo.setBackground(Color.white);
    thresholdCombo.setFont(smallFont);
    thresholdCombo.addActionListener(this);
    add(thresholdCombo);

    JPanel peakThresholdPanel = new JPanel();
    peakThresholdPanel.setBackground(Color.white);
    peakThresholdPanel.setLayout(new BoxLayout(peakThresholdPanel, BoxLayout.X_AXIS));

    GUIUtils.addLabel(peakThresholdPanel, "Value: ", SwingConstants.RIGHT);

    peakTextField = new JTextField();
    peakTextField.setPreferredSize(new Dimension(50, 15));
    peakTextField.setFont(smallFont);
    peakTextField.addActionListener(this);
    peakThresholdPanel.add(peakTextField);
    add(peakThresholdPanel);

    GUIUtils.addLabel(this, " from peak list: ", SwingConstants.RIGHT);

    peakListSelector = new JComboBox<PeakList>();
    peakListSelector.setBackground(Color.white);
    peakListSelector.setFont(smallFont);
    peakListSelector.addActionListener(masterFrame);
    peakListSelector.setActionCommand("PEAKLIST_CHANGE");
    add(peakListSelector);

    thresholdSettings = parameters.getParameter(IDAParameters.peakThresholdSettings);

    thresholdCombo.setSelectedItem(thresholdSettings.getMode());

    add(Box.createHorizontalStrut(10));

    add(Box.createHorizontalGlue());

}

From source file:brainflow.app.presentation.controls.FileObjectGroupSelector.java

public FileObjectGroupSelector(FileObject root) throws FileSystemException {
    if (root.getType() != FileType.FOLDER) {
        throw new IllegalArgumentException("root file must be a directory");
    }/*from   w w w  .j  a  v  a 2  s. c om*/

    rootFolder = root;
    explorer = new FileExplorer(rootFolder);
    explorer.getJTree().setRootVisible(false);
    explorer.getJTree().getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);

    setLayout(new BorderLayout());

    Box topPanel = new Box(BoxLayout.X_AXIS);
    topPanel.setBorder(BorderFactory.createEmptyBorder(8, 12, 8, 8));
    topPanel.add(regexLabel);
    topPanel.add(regexField);
    topPanel.add(Box.createHorizontalStrut(4));
    topPanel.add(searchType);
    add(topPanel, BorderLayout.NORTH);

    //JPanel mainPanel = new JPanel();
    //MigLayout layout = new MigLayout("");
    // mainPanel.setLayout(layout);

    //add(regexLabel);
    //add(regexField, "gap left 0, growx");
    //add(findButton, "align right, wrap");

    //add(searchType, "wrap");

    //add(createSplitPane(), "span 3, grow, wrap");
    add(createSplitPane(), BorderLayout.CENTER);

    depthSpinner.setMaximumSize(new Dimension(50, 200));
    depthSpinner.setModel(new SpinnerNumberModel(recursiveDepth, 0, 5, 1));

    JPanel bottomPanel = new JPanel();
    MigLayout layout = new MigLayout("", "[][grow]", "[][]");
    bottomPanel.setLayout(layout);

    //bottomPanel.setBorder(BorderFactory.createEmptyBorder(4,12,8,8));
    bottomPanel.add(new JLabel("Root Folder: "));
    rootField.setEditable(false);
    rootField.setText(root.getName().getBaseName());
    bottomPanel.add(rootField, "wrap, width 150:150:150");
    bottomPanel.add(new JLabel("Search Depth: "), "gap top 8");

    bottomPanel.add(depthSpinner, "width 35:45:55, wrap");
    add(bottomPanel, BorderLayout.SOUTH);

    explorer.addTreeSelectionListener(new TreeSelectionListener() {
        @Override
        public void valueChanged(TreeSelectionEvent e) {
            TreePath path = e.getPath();
            Object[] obj = path.getPath();
            Object lastNode = obj[obj.length - 1];
            if (lastNode instanceof FileExplorer.FileObjectNode) {
                FileExplorer.FileObjectNode fnode = (FileExplorer.FileObjectNode) lastNode;
                try {
                    if (fnode.getFileObject().getType() == FileType.FOLDER) {
                        rootField.setText(fnode.getFileObject().getName().getBaseName());
                        rootFolder = fnode.getFileObject();
                        updateFileList();
                    }
                } catch (FileSystemException ex) {
                    throw new RuntimeException(ex);
                }

            }
        }
    });

    depthSpinner.addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            recursiveDepth = ((Number) depthSpinner.getValue()).intValue();

            updateFileList();
        }
    });

    regexField.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            updateFileList();
            System.out.println(Arrays.toString(explorer.getSelectedNodes().toArray()));
        }
    });

}

From source file:net.sf.mzmine.modules.visualization.msms.MsMsBottomPanel.java

MsMsBottomPanel(MsMsVisualizerWindow masterFrame, RawDataFile dataFile, ParameterSet parameters) {

    this.dataFile = dataFile;
    this.masterFrame = masterFrame;

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

    setBackground(Color.white);//from  w  w  w  .j a va 2s. co m
    setBorder(new EmptyBorder(5, 5, 5, 0));

    add(Box.createHorizontalGlue());

    GUIUtils.addLabel(this, "Show: ", SwingConstants.RIGHT);

    thresholdCombo = new JComboBox<Object>(PeakThresholdMode.values());
    thresholdCombo.setSelectedItem(PeakThresholdMode.NONE);
    thresholdCombo.setBackground(Color.white);
    thresholdCombo.setFont(smallFont);
    thresholdCombo.addActionListener(this);
    add(thresholdCombo);

    JPanel peakThresholdPanel = new JPanel();
    peakThresholdPanel.setBackground(Color.white);
    peakThresholdPanel.setLayout(new BoxLayout(peakThresholdPanel, BoxLayout.X_AXIS));

    GUIUtils.addLabel(peakThresholdPanel, "Value: ", SwingConstants.RIGHT);

    peakTextField = new JTextField();
    peakTextField.setPreferredSize(new Dimension(50, 15));
    peakTextField.setFont(smallFont);
    peakTextField.addActionListener(this);
    peakThresholdPanel.add(peakTextField);
    add(peakThresholdPanel);

    GUIUtils.addLabel(this, " from peak list: ", SwingConstants.RIGHT);

    peakListSelector = new JComboBox<PeakList>();
    peakListSelector.setBackground(Color.white);
    peakListSelector.setFont(smallFont);
    peakListSelector.addActionListener(masterFrame);
    peakListSelector.setActionCommand("PEAKLIST_CHANGE");
    add(peakListSelector);

    thresholdSettings = parameters.getParameter(MsMsParameters.peakThresholdSettings);

    thresholdCombo.setSelectedItem(thresholdSettings.getMode());

    add(Box.createHorizontalStrut(10));

    add(Box.createHorizontalGlue());

}

From source file:com.idealista.solrmeter.view.statistic.OperationTimeLineChartPanel.java

private Component createCheckBoxPanel() {
    JPanel panelCheckBox = new JPanel();
    panelCheckBox.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    panelCheckBox.setLayout(new BoxLayout(panelCheckBox, BoxLayout.X_AXIS));
    checkBoxShowCommit = new JCheckBox(I18n.get("statistic.operationTimeLineChartPanel.checkbox.commit"));
    checkBoxShowCommit.addActionListener(this);
    checkBoxShowOptimize = new JCheckBox(I18n.get("statistic.operationTimeLineChartPanel.checkbox.optimize"));
    checkBoxShowOptimize.addActionListener(this);
    checkBoxShowAdd = new JCheckBox(I18n.get("statistic.operationTimeLineChartPanel.checkbox.add"));
    checkBoxShowAdd.addActionListener(this);
    checkBoxShowQueries = new JCheckBox(I18n.get("statistic.operationTimeLineChartPanel.checkbox.query"));
    checkBoxShowQueries.addActionListener(this);
    panelCheckBox.add(Box.createHorizontalGlue());
    panelCheckBox.add(checkBoxShowCommit);
    panelCheckBox.add(Box.createHorizontalGlue());
    panelCheckBox.add(checkBoxShowOptimize);
    panelCheckBox.add(Box.createHorizontalGlue());
    panelCheckBox.add(checkBoxShowQueries);
    panelCheckBox.add(Box.createHorizontalGlue());
    panelCheckBox.add(checkBoxShowAdd);//from  w w w.j av a2 s.  c om
    panelCheckBox.add(Box.createHorizontalGlue());
    panelCheckBox.setMaximumSize(new Dimension(800, 25));
    checkAll();
    return panelCheckBox;
}

From source file:UndoableToggleApp.java

public UndoableToggleApp() {

    // Create some toggle buttons (and subclasses)
    JToggleButton tog = new JToggleButton("ToggleButton");
    JCheckBox cb = new JCheckBox("CheckBox");
    JRadioButton radio = new JRadioButton("RadioButton");

    // Add our listener to each toggle button
    SimpleListener sl = new SimpleListener();
    tog.addActionListener(sl);/*ww w . j av  a2 s  .  co m*/
    cb.addActionListener(sl);
    radio.addActionListener(sl);

    // Layout the buttons
    Box buttonBox = new Box(BoxLayout.Y_AXIS);
    buttonBox.add(tog);
    buttonBox.add(cb);
    buttonBox.add(radio);

    // Create undo and redo buttons (initially disabled)
    undoButton = new JButton("Undo");
    redoButton = new JButton("Redo");
    undoButton.setEnabled(false);
    redoButton.setEnabled(false);

    // Add a listener to the undo button. It attempts to call undo() on the
    // current edit, then enables/disables the undo/redo buttons as
    // appropriate.
    undoButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ev) {
            try {
                edit.undo();
            } catch (CannotUndoException ex) {
                ex.printStackTrace();
            } finally {
                undoButton.setEnabled(edit.canUndo());
                redoButton.setEnabled(edit.canRedo());
            }
        }
    });

    // Add a redo listener: just like the undo listener, but for redo this
    // time.
    redoButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ev) {
            try {
                edit.redo();
            } catch (CannotRedoException ex) {
                ex.printStackTrace();
            } finally {
                undoButton.setEnabled(edit.canUndo());
                redoButton.setEnabled(edit.canRedo());
            }
        }
    });

    // Layout the undo/redo buttons
    Box undoRedoBox = new Box(BoxLayout.X_AXIS);
    undoRedoBox.add(Box.createGlue());
    undoRedoBox.add(undoButton);
    undoRedoBox.add(Box.createHorizontalStrut(2));
    undoRedoBox.add(redoButton);
    undoRedoBox.add(Box.createGlue());

    // Layout the main frame
    Container content = getContentPane();
    content.setLayout(new BorderLayout());
    content.add(buttonBox, BorderLayout.CENTER);
    content.add(undoRedoBox, BorderLayout.SOUTH);
    setSize(400, 150);
}

From source file:Transfer.java

public Transfer() {

    // Establish the GUI
    Container cp = new Box(BoxLayout.X_AXIS);
    setContentPane(cp);//from w  w  w  .  j  av  a2 s  .  c o  m
    JPanel firstPanel = new JPanel();
    propertyComboBox = new JComboBox();
    propertyComboBox.addItem("text");
    propertyComboBox.addItem("font");
    propertyComboBox.addItem("background");
    propertyComboBox.addItem("foreground");
    firstPanel.add(propertyComboBox);
    cp.add(firstPanel);
    cp.add(Box.createGlue());

    tf = new JTextField("Hello");
    tf.setForeground(Color.RED);
    tf.setDragEnabled(true);
    cp.add(tf);

    cp.add(Box.createGlue());

    l = new JLabel("Hello");
    l.setBackground(Color.YELLOW);
    cp.add(l);

    cp.add(Box.createGlue());

    JSlider stryder = new JSlider(SwingConstants.VERTICAL);
    stryder.setMinimum(10);
    stryder.setValue(14);
    stryder.setMaximum(72);
    stryder.setMajorTickSpacing(10);
    stryder.setPaintTicks(true);

    cp.add(stryder);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setSize(500, 300);

    // Add Listeners and Converters
    setMyTransferHandlers((String) propertyComboBox.getSelectedItem());

    // Mousing in the Label starts a Drag.
    MouseListener myDragListener = new MouseAdapter() {
        public void mousePressed(MouseEvent e) {
            JComponent c = (JComponent) e.getSource();
            TransferHandler handler = c.getTransferHandler();
            handler.exportAsDrag(c, e, TransferHandler.COPY);
        }
    };
    l.addMouseListener(myDragListener);

    // Selecting in the ComboBox makes that the property that is xfered.
    propertyComboBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ce) {
            JComboBox bx = (JComboBox) ce.getSource();
            String prop = (String) bx.getSelectedItem();
            setMyTransferHandlers(prop);
        }
    });

    // Typing a word and pressing enter in the TextField tries
    // to set that as the font name.
    tf.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            JTextField jtf = (JTextField) evt.getSource();
            String fontName = jtf.getText();
            Font font = new Font(fontName, Font.BOLD, 18);
            tf.setFont(font);
        }
    });

    // Setting the Slider sets that font into the textfield.
    stryder.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent evt) {
            JSlider sl = (JSlider) evt.getSource();
            Font oldf = tf.getFont();
            Font newf = oldf.deriveFont((float) sl.getValue());
            tf.setFont(newf);
        }
    });

}

From source file:gdt.jgui.tool.JTextEncrypter.java

/**
 * The default constructor.//from www  .ja v  a  2  s  .  com
 */
public JTextEncrypter() {
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    JPanel panel = new JPanel();
    panel.setBorder(
            new TitledBorder(null, "Master password", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    add(panel);
    panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
    JCheckBox chckbxNewCheckBox = new JCheckBox("Show");
    chckbxNewCheckBox.setHorizontalTextPosition(SwingConstants.LEFT);
    chckbxNewCheckBox.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() != ItemEvent.SELECTED) {
                passwordField.setEchoChar('*');
            } else {
                passwordField.setEchoChar((char) 0);
            }
        }
    });
    panel.add(chckbxNewCheckBox);
    panel.setFocusTraversalPolicy(
            new FocusTraversalOnArray(new Component[] { chckbxNewCheckBox, passwordField }));
    passwordField = new JPasswordField();
    passwordField.setMaximumSize(new Dimension(Integer.MAX_VALUE, passwordField.getPreferredSize().height));
    panel.add(passwordField);

    JPanel panel_1 = new JPanel();
    panel_1.setBorder(new TitledBorder(null, "Text", TitledBorder.LEADING, TitledBorder.TOP, null, null));
    add(panel_1);
    panel_1.setLayout(new BorderLayout(0, 0));

    textArea = new JTextArea();
    textArea.setColumns(1);
    panel_1.add(textArea);

}

From source file:mergedoc.ui.MergeDocFrame.java

/**
 * ??????//from  w w w .  j a  va  2 s .  c  o  m
 * @throws MergeDocException ?????
 */
private void initComponent() throws MergeDocException {

    // ????
    preferencePanel = new PreferencePanel();
    mergeManager = new MergeManager();

    // ???
    mainPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
    mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.X_AXIS));
    mainPanel.add(preferencePanel);

    // ??????
    JPanel outerPanel = new JPanel();
    outerPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    outerPanel.setLayout(new BoxLayout(outerPanel, BoxLayout.Y_AXIS));
    outerPanel.add(mainPanel);
    outerPanel.add(ComponentFactory.createSpacer(0, 7));
    outerPanel.add(buttonBar);
    getContentPane().add(outerPanel);

    // ?
    initListener();
    buttonBar.setState(buttonBar.INIT_STATE);

    // 
    ConfigManager config = ConfigManager.getInstance();
    String iconPath = config.getFile("icon.png").toString();
    Image icon = Toolkit.getDefaultToolkit().createImage(iconPath);
    setIconImage(icon);

    // 
    setTitle(SETTING_TITLE);
    Persister psst = Persister.getInstance();
    setLocation(psst.getInt(Persister.WINDOW_X, 0), psst.getInt(Persister.WINDOW_Y, 0));
    setSize(psst.getInt(Persister.WINDOW_WIDTH, 700), psst.getInt(Persister.WINDOW_HEIGHT, 570));
    int state = psst.getInt(Persister.WINDOW_STATE, NORMAL);
    if ((state & Frame.ICONIFIED) != ICONIFIED) {
        setExtendedState(state);
    }
    setVisible(true);
}

From source file:gdt.jgui.entity.JEntityStructurePanel.java

/**
 * The default constructor.//from w ww  . ja  va 2  s.c o m
 */
public JEntityStructurePanel() {
    setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
    scrollPane = new JScrollPane();
    add(scrollPane);
    popup = new JPopupMenu();
    popup.addPopupMenuListener(new PopupMenuListener() {
        @Override
        public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
            popup.removeAll();
            JMenuItem facetsItem = new JMenuItem("Facets");
            popup.add(facetsItem);
            facetsItem.setHorizontalTextPosition(JMenuItem.RIGHT);
            facetsItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    //   System.out.println("EntityStructurePanel:renderer:component locator$="+nodeLocator$);
                    JEntityFacetPanel efp = new JEntityFacetPanel();
                    String efpLocator$ = efp.getLocator();
                    Properties locator = Locator.toProperties(selection$);
                    String entihome$ = locator.getProperty(Entigrator.ENTIHOME);
                    String entityKey$ = locator.getProperty(EntityHandler.ENTITY_KEY);
                    efpLocator$ = Locator.append(efpLocator$, Entigrator.ENTIHOME, entihome$);
                    efpLocator$ = Locator.append(efpLocator$, EntityHandler.ENTITY_KEY, entityKey$);
                    JConsoleHandler.execute(console, efpLocator$);
                }
            });
            JMenuItem copyItem = new JMenuItem("Copy");
            popup.add(copyItem);
            copyItem.setHorizontalTextPosition(JMenuItem.RIGHT);
            copyItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    console.clipboard.clear();
                    String locator$ = (String) node.getUserObject();
                    if (locator$ != null)
                        console.clipboard.putString(locator$);
                }
            });

            if (!isFirst) {
                popup.addSeparator();
                JMenuItem excludeItem = new JMenuItem("Exclude");
                popup.add(excludeItem);
                excludeItem.setHorizontalTextPosition(JMenuItem.RIGHT);
                excludeItem.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        int response = JOptionPane.showConfirmDialog(console.getContentPanel(), "Exclude ?",
                                "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
                        if (response == JOptionPane.YES_OPTION) {
                            try {
                                Properties locator = Locator.toProperties(selection$);
                                String entihome$ = locator.getProperty(Entigrator.ENTIHOME);
                                String entityKey$ = locator.getProperty(EntityHandler.ENTITY_KEY);
                                Entigrator entigrator = console.getEntigrator(entihome$);
                                Sack component = entigrator.getEntityAtKey(entityKey$);
                                String[] sa = entigrator.ent_listContainers(component);
                                if (sa != null) {
                                    Sack container;
                                    for (String aSa : sa) {
                                        container = entigrator.getEntityAtKey(aSa);
                                        if (container != null)
                                            entigrator.col_breakRelation(container, component);
                                    }
                                }
                                JConsoleHandler.execute(console, JEntityStructurePanel.this.locator$);
                            } catch (Exception ee) {
                                Logger.getLogger(JEntityStructurePanel.class.getName()).info(ee.toString());
                            }
                        }
                    }
                });

                JMenuItem deleteItem = new JMenuItem("Delete");
                popup.add(deleteItem);
                deleteItem.setHorizontalTextPosition(JMenuItem.RIGHT);
                deleteItem.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        int response = JOptionPane.showConfirmDialog(console.getContentPanel(), "Delete ?",
                                "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE);
                        if (response == JOptionPane.YES_OPTION) {
                            try {
                                Properties locator = Locator.toProperties(selection$);
                                String entihome$ = locator.getProperty(Entigrator.ENTIHOME);
                                String entityKey$ = locator.getProperty(EntityHandler.ENTITY_KEY);
                                Entigrator entigrator = console.getEntigrator(entihome$);
                                Sack component = entigrator.getEntityAtKey(entityKey$);
                                entigrator.deleteEntity(component);
                                JConsoleHandler.execute(console, JEntityStructurePanel.this.locator$);
                            } catch (Exception ee) {
                                Logger.getLogger(JEntityStructurePanel.class.getName()).info(ee.toString());
                            }
                        }
                    }
                });
            }
            if (hasToInclude()) {
                popup.addSeparator();
                JMenuItem includeItem = new JMenuItem("Include");
                popup.add(includeItem);
                includeItem.setHorizontalTextPosition(JMenuItem.RIGHT);
                includeItem.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        include();
                        JConsoleHandler.execute(console, JEntityStructurePanel.this.locator$);
                    }
                });
            }
        }

        @Override
        public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
        }

        @Override
        public void popupMenuCanceled(PopupMenuEvent e) {
            // TODO Auto-generated method stub
        }
    });
}

From source file:medsavant.uhn.cancer.SetCommentStatusDialog.java

private JPanel getMainPanel() {
    JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));

    //Status box.
    mainPanel.add(getStatusEditorPanel());

    //Comment box.
    JPanel p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
    p.add(Box.createHorizontalGlue());
    comment = new JTextArea();
    p.add(comment);/*from  w w  w.  j a v a  2  s . co  m*/
    p.add(Box.createHorizontalGlue());
    mainPanel.add(p);

    //Button box.        
    p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
    p.add(Box.createHorizontalGlue());
    JButton OKButton = new JButton("Update status");
    OKButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            try {
                updateStatus();
                dispose();
            } catch (Exception ex) {
                LOG.error(ex.getMessage(), ex);
                DialogUtils.displayException("Error", ex.getMessage(), ex);
            }
        }
    });

    JButton cancelButton = new JButton("Cancel");
    cancelButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            dispose();
        }
    });
    p.add(OKButton);
    p.add(cancelButton);
    p.add(Box.createHorizontalGlue());
    mainPanel.add(p);

    return mainPanel;
}