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:org.openmicroscopy.shoola.agents.treeviewer.view.ToolBar.java

/** Builds and lays out the UI. */
private void buildGUI() {
    JPanel bars = new JPanel(), outerPanel = new JPanel();
    bars.setBorder(null);//from w ww.java2  s . c  o  m
    bars.setLayout(new BoxLayout(bars, BoxLayout.X_AXIS));
    bars.add(createManagementBar());
    if (!TreeViewerWin.JXTASKPANE_TYPE.equals(view.getLayoutType())) {
        bars.add(createSearchBar());
    }

    outerPanel.setBorder(null);
    outerPanel.setLayout(new BoxLayout(outerPanel, BoxLayout.X_AXIS));
    outerPanel.add(bars);
    outerPanel.add(Box.createRigidArea(HBOX));
    outerPanel.add(Box.createHorizontalGlue());

    setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
    add(UIUtilities.buildComponentPanel(outerPanel));
    add(UIUtilities.buildComponentPanelRight(buildRightPane()));
}

From source file:org.openmicroscopy.shoola.agents.treeviewer.view.ToolBar.java

/** 
 * Builds and lays out the component displayed on the right hand side of
 * the toolbar./*from  www . j  av  a2  s .co  m*/
 * 
 * @return See above.
 */
private JPanel buildRightPane() {
    JPanel p = new JPanel();
    p.setBorder(null);
    p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
    p.add(importFailureLabel);
    p.add(Box.createHorizontalStrut(5));
    p.add(importSuccessLabel);
    p.add(Box.createHorizontalStrut(5));
    p.add(importLabel);
    return p;
}

From source file:org.openmicroscopy.shoola.agents.util.EditorUtil.java

/**
 * Formats the label for a required field.
 * /*from ww  w  .j av a  2s .com*/
 * @param value The value to display.
 * @param required Pass <code>true</code> if the field is required,
 *                 <code>false</code> otherwise.
 * @return See above
 */
public static JComponent getLabel(String value, boolean required) {
    if (required) {
        JPanel p = new JPanel();
        p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
        JLabel l = UIUtilities.setTextFont(value);
        p.add(l);
        l = UIUtilities.setTextFont(MANDATORY_SYMBOL);
        l.setForeground(UIUtilities.REQUIRED_FIELDS_COLOR);
        p.add(l);
        return p;
    }
    return UIUtilities.setTextFont(value);
}

From source file:org.openmicroscopy.shoola.agents.util.SelectionWizard.java

/**
 * Creates the filtering controls./*from w w w.  ja v  a 2s .c o  m*/
 *
 * @return See above.
 */
private JPanel createFilteringControl() {
    JPanel p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
    p.add(new JLabel("Filter by"));
    String txt = null;
    if (TagAnnotationData.class.equals(type)) {
        txt = "tag";
    } else if (TagAnnotationData.class.equals(type)) {
        txt = "attachment";
    }
    String[] values = new String[2];
    StringBuilder builder = new StringBuilder();
    builder.append("start of ");
    if (txt != null) {
        builder.append(txt);
        builder.append(" ");
    }
    builder.append("name");
    values[0] = builder.toString();

    builder = new StringBuilder();
    builder.append("anywhere in ");
    if (txt != null) {
        builder.append(txt);
        builder.append(" ");
    }
    builder.append("name");
    values[1] = builder.toString();
    JComboBox box = new JComboBox(values);
    int selected = 0;
    if (uiDelegate.isFilterAnywhere())
        selected = 1;
    box.setSelectedIndex(selected);
    box.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            JComboBox src = (JComboBox) e.getSource();
            uiDelegate.setFilterAnywhere(src.getSelectedIndex() == 1);
        }
    });
    JPanel rows = new JPanel();
    rows.setLayout(new BoxLayout(rows, BoxLayout.Y_AXIS));
    p.add(box);
    rows.add(p);
    if (!ExperimenterData.class.equals(type)) {
        //Filter by owner
        p = new JPanel();
        p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
        p.add(new JLabel("Filter by owner"));
        values = new String[3];
        values[SelectionWizardUI.ALL] = "All";
        values[SelectionWizardUI.CURRENT] = "Owned by me";
        values[SelectionWizardUI.OTHERS] = "Owned by others";
        box = new JComboBox(values);
        box.addActionListener(new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                JComboBox src = (JComboBox) e.getSource();
                uiDelegate.setOwnerIndex(src.getSelectedIndex());
            }
        });
        p.add(box);
        rows.add(p);
    }
    return UIUtilities.buildComponentPanel(rows);
}

From source file:org.openmicroscopy.shoola.agents.util.SelectionWizard.java

/**
 * Builds and lays out the component to add new objects to the selection.
 * /*from w  w  w.  j a v  a 2  s.  co  m*/
 * @return See above.
 */
private JPanel createAdditionPane() {
    JPanel p = new JPanel();
    p.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
    if (TagAnnotationData.class.equals(type)) {
        formatAddLabelText();
        p.add(UIUtilities.buildComponentPanel(addLabel));
        JPanel pane = new JPanel();
        pane.setLayout(new BoxLayout(pane, BoxLayout.X_AXIS));
        pane.add(addField);
        pane.add(Box.createHorizontalStrut(5));
        pane.add(descriptionField);
        pane.add(addNewButton);
        p.add(pane);
    }
    return UIUtilities.buildComponentPanel(p);
}

From source file:org.openmicroscopy.shoola.agents.util.ui.ScriptComponent.java

/**
 * Returns the label associated to the component.
 * /*from w  ww  . ja  va 2s.  c  o  m*/
 * @return See above.
 */
private JComponent getLabel() {
    JPanel p = new JPanel();
    p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
    if (requireLabel != null) {
        JPanel lp = new JPanel();
        lp.setLayout(new BoxLayout(lp, BoxLayout.X_AXIS));
        lp.add(label);
        lp.add(requireLabel);
        p.add(lp);
    } else
        p.add(label);

    if (info != null)
        p.add(info);
    return UIUtilities.buildComponentPanel(p, 0, 0);
}

From source file:org.openmicroscopy.shoola.agents.util.ui.ScriptingDialog.java

/**
 * Builds the panel hosting the components.
 *
 * @return See above./* w  w w. j av a2 s  .  co  m*/
 */
private JPanel buildControlPanel() {
    JPanel controlPanel = new JPanel();
    controlPanel.setBorder(null);
    controlPanel.add(cancelButton);
    controlPanel.add(Box.createRigidArea(H_SPACER_SIZE));
    controlPanel.add(applyButton);
    controlPanel.add(Box.createRigidArea(H_SPACER_SIZE));
    JPanel bar = new JPanel();
    bar.setLayout(new BoxLayout(bar, BoxLayout.Y_AXIS));
    bar.add(controlPanel);
    bar.add(Box.createVerticalStrut(10));

    JPanel all = new JPanel();
    all.setLayout(new BoxLayout(all, BoxLayout.X_AXIS));
    all.add(UIUtilities.buildComponentPanel(menuButton));
    all.add(UIUtilities.buildComponentPanelRight(bar));
    return all;
}

From source file:org.openmicroscopy.shoola.env.ui.TaskBarView.java

/**
 * Helper method to create the window's toolbars panel.
 * This panel contains all the predefined toolbars (file, connect, and
 * help) as well as those specified by {@link TaskBar}.
 *
 * @return The window's toolbars panel./*from w ww  .  j  a va2s .com*/
 */
private JPanel createToolBarsPanel() {
    createButtons();
    JToolBar file = createToolBar(), connect = createToolBar(), help = createToolBar();
    file.add(buttons[EXIT_BTN]);
    connect.add(buttons[CONNECT_BTN]);
    connect.add(buttons[DISCONNECT_BTN]);
    help.add(buttons[HELP_BTN]);
    JPanel bars = new JPanel(), outerPanel = new JPanel();
    bars.setBorder(null);
    bars.setLayout(new BoxLayout(bars, BoxLayout.X_AXIS));
    bars.add(file);
    bars.add(connect);
    bars.add(help);
    outerPanel.setBorder(null);
    outerPanel.setLayout(new BoxLayout(outerPanel, BoxLayout.X_AXIS));
    outerPanel.add(bars);
    outerPanel.add(Box.createRigidArea(new Dimension(100, 16)));
    outerPanel.add(Box.createHorizontalGlue());
    return outerPanel;
}

From source file:org.openmicroscopy.shoola.util.ui.MessengerDialog.java

/**
 * Builds and lays out the buttons.//from w  w w . jav a 2s.  com
 * 
 * @param submit Pass <code>true</code> to display the submit files option,
 *              <code>false</code> otherwise.
 * @return See above.
 */
private JPanel buildToolBar(boolean submit) {
    JPanel bars = new JPanel();
    bars.setLayout(new BoxLayout(bars, BoxLayout.X_AXIS));
    if (submit) {
        JPanel row = new JPanel();
        row.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
        row.add(new JLabel("Submit Exceptions and: "));
        row.add(UIUtilities.buildComponentPanel(submitFile));
        JPanel p = new JPanel();
        p.setBorder(null);
        p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
        p.add(row);
        JPanel progressPane = new JPanel();
        progressPane.setLayout(new BoxLayout(progressPane, BoxLayout.X_AXIS));
        progressPane.add(progress);
        progressPane.add(Box.createHorizontalStrut(5));
        progressPane.add(progressLabel);
        p.add(UIUtilities.buildComponentPanel(progressPane));
        bars.add(UIUtilities.buildComponentPanel(p));
    }
    JPanel bar = new JPanel();
    bar.setLayout(new BoxLayout(bar, BoxLayout.X_AXIS));
    bar.add(cancelButton);
    bar.add(Box.createHorizontalStrut(5));
    bar.add(sendButton);
    bar.add(Box.createHorizontalStrut(10));
    bars.add(UIUtilities.buildComponentPanelRight(bar));
    return bars;
}

From source file:org.openmicroscopy.shoola.util.ui.search.SearchComponent.java

/** 
 * Lays out the components indicating the status.
 * /*from ww w .ja va2 s.  co  m*/
 * @return See above.
 */
private JPanel buildStatusBar() {
    JPanel bar = new JPanel();
    bar.setBackground(UIUtilities.BACKGROUND_COLOR);
    bar.setLayout(new BoxLayout(bar, BoxLayout.X_AXIS));
    bar.add(progressLabel);
    JPanel p = UIUtilities.buildComponentPanelCenter(busyLabel);
    p.setBackground(UIUtilities.BACKGROUND_COLOR);
    bar.add(p);
    return bar;
}