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.colombbus.tangara.CommandSelection.java

/**
 * This method initializes panelSelection
 *
 * @return javax.swing.JPanel/*w w w . j av  a2s . com*/
 */
private JPanel getPanelSelection() {
    if (panelSelection == null) {
        panelSelection = new JPanel();
        panelSelection.setBorder(new EmptyBorder(MARGIN_Y / 2, MARGIN_X, MARGIN_Y / 2, MARGIN_X));
        panelSelection.setLayout(new BoxLayout(panelSelection, BoxLayout.X_AXIS));
        panelSelection.add(Box.createHorizontalStrut(MARGIN_BUTTON));
        panelSelection.add(getButtonSelectAll());
        panelSelection.add(Box.createHorizontalGlue());
        panelSelection.add(getButtonSelectNone());
        panelSelection.add(Box.createHorizontalStrut(MARGIN_BUTTON));
    }
    return panelSelection;
}

From source file:org.colombbus.tangara.ConfigurationWindow.java

/**
 * This method initializes bottomPanel//from  w w  w . j  a  v  a2 s. c  o  m
 *
 * @return javax.swing.JPanel
 */
private JPanel getBottomPanel() {
    if (bottomPanel == null) {
        bottomPanel = new JPanel();
        bottomPanel.setLayout(new BoxLayout(bottomPanel, BoxLayout.X_AXIS));
        bottomPanel.add(getRestoreButton());
        bottomPanel.add(Box.createHorizontalStrut(10));
        bottomPanel.add(getSaveButton());
        bottomPanel.add(Box.createHorizontalGlue());
        bottomPanel.add(getCancelButton());
        bottomPanel.setBorder(new EmptyBorder(MARGIN_Y, MARGIN_X, MARGIN_X, MARGIN_Y));
    }
    return bottomPanel;
}

From source file:org.ecoinformatics.seek.ecogrid.EcogridPreferencesTab.java

private void initButtonPanel() {

    // remember default button font
    final Font defaultUIMgrButtonFont = (Font) UIManager.get("Button.font");

    // now set our custom size, provided it's smaller than the default:
    int buttonFontSize = (defaultUIMgrButtonFont.getSize() < BUTTON_FONT_SIZE)
            ? defaultUIMgrButtonFont.getSize()
            : BUTTON_FONT_SIZE;/*from  w w  w  . j ava2 s  .c  o m*/

    final Font BUTTON_FONT = new Font(defaultUIMgrButtonFont.getFontName(), defaultUIMgrButtonFont.getStyle(),
            buttonFontSize);

    UIManager.put("Button.font", BUTTON_FONT);

    refreshButton = new JButton(new ServicesRefreshAction(
            StaticResources.getDisplayString("preferences.data.refresh", "Refresh"), this));
    refreshButton.setMinimumSize(EcogridPreferencesTab.BUTTONDIMENSION);
    refreshButton.setPreferredSize(EcogridPreferencesTab.BUTTONDIMENSION);
    refreshButton.setSize(EcogridPreferencesTab.BUTTONDIMENSION);
    // setMaximumSize was truncating label on osX. I don't know why. 
    // It seems about the same as how SearchUIJPanel does things. -derik
    //refreshButton.setMaximumSize(EcogridPreferencesTab.BUTTONDIMENSION);

    keepExistingCheckbox = new JCheckBox(
            StaticResources.getDisplayString("preferences.data.keepExistingSources", "Keep existing sources"));
    keepExistingCheckbox.setSelected(false);

    JPanel bottomPanel = new JPanel();

    bottomPanel.setLayout(new BoxLayout(bottomPanel, BoxLayout.X_AXIS));
    bottomPanel.add(refreshButton);
    bottomPanel.add(keepExistingCheckbox);

    newButtonPanel = new JPanel();
    newButtonPanel.setLayout(new BorderLayout());
    newButtonPanel.add(Box.createVerticalStrut(EcogridPreferencesTab.MARGINGSIZE), BorderLayout.NORTH);
    newButtonPanel.add(bottomPanel, BorderLayout.SOUTH);
    setButtonPanel(newButtonPanel);

    // restore default button font
    if (defaultUIMgrButtonFont != null) {
        UIManager.put("Button.font", defaultUIMgrButtonFont);
    }
}

From source file:org.ecoinformatics.seek.ecogrid.EcogridPreferencesTab.java

/**
 * Description of the Method//from ww w  . j  a  va2s. c o m
 */
private void initTextPanel() {
    // text part of text panel
    JPanel textTopPanel = new JPanel();
    textTopPanel.setLayout(new BoxLayout(textTopPanel, BoxLayout.X_AXIS));
    textTopPanel.add(textLabel);
    textTopPanel.add(Box.createHorizontalGlue());
    // y box layout
    textPanel.setLayout(new BoxLayout(textPanel, BoxLayout.Y_AXIS));
    textPanel.add(textTopPanel);
    textPanel.add(Box.createVerticalStrut(GAP));
}

From source file:org.ecoinformatics.seek.ecogrid.RegistrySearchDialog.java

private void initMainPanel() {
    JPanel selectionPanel = new JPanel();
    selectionPanel.setLayout(new BoxLayout(selectionPanel, BoxLayout.X_AXIS));
    initOptions();//from   w w w  .  ja v a  2  s. com
    optionList = new JComboBox(options);
    optionList.setEditable(false);
    optionList.addItemListener(new TextFieldEnableController());
    selectionPanel.add(optionList);
    selectionPanel.add(Box.createHorizontalStrut(EcogridPreferencesTab.GAP));
    JLabel label = new JLabel(CONTAINS);
    selectionPanel.add(label);
    selectionPanel.add(Box.createHorizontalStrut(EcogridPreferencesTab.GAP));
    inputField.setEnabled(false);
    selectionPanel.add(inputField);
    selectionPanel.add(Box.createHorizontalGlue());

    mainPanel.setLayout(new BorderLayout());
    mainPanel.add(selectionPanel, BorderLayout.NORTH);
    mainPanel.add(Box.createVerticalGlue(), BorderLayout.CENTER);

    JPanel buttonPanel = new JPanel();
    JPanel rightButtonPanel = new JPanel();
    rightButtonPanel.setLayout(new BoxLayout(rightButtonPanel, BoxLayout.X_AXIS));
    /*searchButton = new JButton(new SearchRegistryAction("Search", this,
    parent, parent.getLocation()));
    searchButton.setPreferredSize(ServicesDisplayFrame.BUTTONDIMENSION);
    searchButton.setMaximumSize(ServicesDisplayFrame.BUTTONDIMENSION);
    rightButtonPanel.add(searchButton);*/
    rightButtonPanel.add(Box.createHorizontalStrut(EcogridPreferencesTab.MARGINGSIZE));
    cancelButton = new JButton(new CancelSearchAction("Cancel", this, parent));
    cancelButton.setPreferredSize(EcogridPreferencesTab.BUTTONDIMENSION);
    cancelButton.setMaximumSize(EcogridPreferencesTab.BUTTONDIMENSION);
    rightButtonPanel.add(cancelButton);
    buttonPanel.setLayout(new BorderLayout());
    buttonPanel.add(Box.createHorizontalGlue(), BorderLayout.CENTER);
    buttonPanel.add(rightButtonPanel, BorderLayout.EAST);

    mainPanel.add(buttonPanel, BorderLayout.SOUTH);
}

From source file:org.jajuk.ui.views.SuggestionView.java

@Override
public void initUI() {
    tabs = new JTabbedPane();
    // Now use the new TabbedPaneUI
    tabs.setUI(new MyTabbedPaneUI());
    // Fill tabs with empty tabs
    tabs.addTab(Messages.getString("SuggestionView.1"),
            UtilGUI.getCentredPanel(new JLabel(Messages.getString("WikipediaView.3"))));
    tabs.addTab(Messages.getString("SuggestionView.2"),
            UtilGUI.getCentredPanel(new JLabel(Messages.getString("WikipediaView.3"))));
    tabs.addTab(Messages.getString("SuggestionView.5"),
            UtilGUI.getCentredPanel(new JLabel(Messages.getString("WikipediaView.3"))));
    tabs.addTab(Messages.getString("SuggestionView.3"), new JLabel(Messages.getString("SuggestionView.7")));
    tabs.addTab(Messages.getString("SuggestionView.4"), new JLabel(Messages.getString("SuggestionView.7")));
    addTabChangeListener();/*from   www . j a va2 s  . c  o m*/
    selectTabFromConf();
    refreshLocalCollectionTabs();
    setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
    add(tabs);
    ObservationManager.register(this);
}

From source file:org.jcurl.demo.tactics.BroomPromptSwingBean.java

public BroomPromptSwingBean() {
    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

    final Box b = Box.createVerticalBox();
    {/*from   ww  w.j  a v a 2s . c o m*/
        final JPanel tb = new JPanel();
        tb.setLayout(new BoxLayout(tb, BoxLayout.X_AXIS));
        tb.setBorder(BorderFactory.createTitledBorder("Active"));
        tb.add(rock = new JComboBox(new Object[] { 1, 2, 3, 4, 5, 6, 7, 8 }));
        rock.setPrototypeDisplayValue(8);
        rock.addItemListener(this);
        dark = new JRadioButton("dark");
        dark.addActionListener(this);
        light = new JRadioButton("light");
        light.addActionListener(this);
        final ButtonGroup bg = new ButtonGroup();
        bg.add(dark);
        bg.add(light);
        tb.add(dark);
        tb.add(light);
        b.add(tb);
    }
    {
        final JPanel tb = new JPanel();
        tb.setLayout(new BoxLayout(tb, BoxLayout.X_AXIS));
        tb.setBorder(BorderFactory.createTitledBorder("Handle"));
        in = new JRadioButton("In Turn");
        in.addActionListener(this);
        out = new JRadioButton("Out Turn");
        out.addActionListener(this);
        final ButtonGroup bg = new ButtonGroup();
        bg.add(in);
        bg.add(out);
        tb.add(out);
        tb.add(in);
        tb.add(Box.createHorizontalGlue());
        b.add(tb);
    }
    {
        final JPanel tb = new JPanel();
        tb.setLayout(new BoxLayout(tb, BoxLayout.X_AXIS));
        tb.setBorder(BorderFactory.createTitledBorder("Split Time"));

        if (UseJSpinnerBoundedRange) {
            split2 = new JSpinnerBoundedRange();
            split2.addFocusListener(this);
            split = null;
        } else {
            split2 = null;
            split = new JSpinner();
            // log.info(split.getEditor().getClass().getName());
            split.addFocusListener(this);
            final JSpinner.NumberEditor ed = (JSpinner.NumberEditor) split.getEditor();
            ed.addFocusListener(this);
            ed.getTextField().addFocusListener(this);
        }

        tb.add(split2);

        tb.add(dt = new JComboBox(new Object[] { "1/1000 sec", "1/100 sec", "1/10 sec", "sec" }));
        tb.add(Box.createHorizontalGlue());
        b.add(tb);
        dt.setEnabled(false);
    }
    {
        final JPanel p = new JPanel();
        p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
        p.setBorder(BorderFactory.createTitledBorder("Broom Position"));
        {
            x = new JSpinnerNumberUnit();
            x.setLabel("x: ");
            x.setBase(Unit.METER);
            x.setChoose(Unit.FOOT, Unit.INCH, Unit.CENTIMETER, Unit.METER);
            x.setModel(new SpinnerNumberModel(0.0, -IceSize.SIDE_2_CENTER, IceSize.SIDE_2_CENTER, 0.1));
            x.addChangeListener(this);
            x.addPropertyChangeListener(this);
            p.add(x);
        }
        {
            y = new JSpinnerNumberUnit();
            y.setLabel("y: ");
            y.setBase(Unit.METER);
            y.setChoose(Unit.FOOT, Unit.INCH, Unit.CENTIMETER, Unit.METER);
            y.setModel(new SpinnerNumberModel(0.0, -IceSize.BACK_2_TEE, IceSize.HOG_2_TEE, 0.1));
            y.addChangeListener(this);
            y.addPropertyChangeListener(this);
            p.add(y);
        }
        b.add(p);
    }
    this.add(b);
}

From source file:org.jcurl.demo.tactics.CurlerSwingBean.java

public CurlerSwingBean() {
    setLayout(new BorderLayout());
    final Box b = Box.createVerticalBox();
    {//from  w  ww .j a  va2s  .c  o  m
        final JPanel p = new JPanel();
        p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
        p.setBorder(BorderFactory.createTitledBorder("Curl Model"));
        p.add(curlers = new JComboBox(findCurlers()));
        b.add(p);
    }
    {
        final JPanel p = new JPanel();
        p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
        p.setBorder(BorderFactory.createTitledBorder("Draw-To-Tee"));
        {
            time = new JSpinnerNumberUnit();
            time.setLabel("time: ");
            time.setBase(Unit.SECOND);
            time.setModel(new SpinnerNumberModel(24.0, 17.0, 28.0, 0.1));
            time.addPropertyChangeListener(this);
            time.addChangeListener(this);
            p.add(time);
        }
        {
            curl = new JSpinnerNumberUnit();
            curl.setLabel("curl: ");
            curl.setBase(Unit.METER);
            curl.setChoose(Unit.FOOT, Unit.INCH, Unit.CENTIMETER, Unit.METER);
            curl.setModel(new SpinnerNumberModel(1.0, 0.0, 3.0, 0.1));
            curl.addPropertyChangeListener(this);
            curl.addChangeListener(this);
            p.add(curl);
        }
        b.add(p);
    }
    add(b, BorderLayout.NORTH);
    add(new JLabel("TODO: other settings"), BorderLayout.CENTER);
    setEnabled(false);
}

From source file:org.kepler.gui.ComponentLibraryPreferencesTab.java

/**
 * Initialize the top panel that contains controls for the table.
 *//*from  w  ww.ja v  a  2  s .c  o  m*/
private void initTopPanel() {

    _newSource = new JButton(StaticResources.getDisplayString("general.ADD", "Add"));
    _newSource.setPreferredSize(new Dimension(100, 50));
    _newSource.addActionListener(new AddSourceListener());

    _removeSource = new JButton(StaticResources.getDisplayString("general.REMOVE", "Remove"));
    _removeSource.setPreferredSize(new Dimension(100, 50));
    _removeSource.addActionListener(new RemoveSourceListener());

    _defaultSources = new JButton(StaticResources.getDisplayString("preferences.useDefaults", "Use Defaults"));
    _defaultSources.setPreferredSize(new Dimension(100, 50));
    _defaultSources.addActionListener(new DefaultSourcesListener());

    _buildLibrary = new JButton(StaticResources.getDisplayString("preferences.build", "Build"));
    _buildLibrary.setPreferredSize(new Dimension(100, 50));
    _buildLibrary.addActionListener(new BuildLibraryListener());

    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
    buttonPanel.setBackground(TabManager.BGCOLOR);
    buttonPanel.setAlignmentX(RIGHT_ALIGNMENT);
    buttonPanel.add(_newSource);
    buttonPanel.add(_removeSource);
    buttonPanel.add(_defaultSources);
    buttonPanel.add(_buildLibrary);

    LibraryManager lm = LibraryManager.getInstance();

    JPanel topPanel = new JPanel(new BorderLayout());
    topPanel.add(buttonPanel, BorderLayout.CENTER);

    add(topPanel);

}

From source file:org.kepler.gui.TabbedDialog.java

private void init() {

    this.setResizable(IS_RESIZABLE);
    mainPanel.setLayout(new BorderLayout());

    getContentPane().add(mainPanel);/*from  w  ww . j a  v a2s . c o m*/

    tabPane.setBorder(BorderFactory.createEmptyBorder(JTABPANE_MARGINS, JTABPANE_MARGINS, 0, JTABPANE_MARGINS));
    mainPanel.add(tabPane, java.awt.BorderLayout.CENTER);
    buttonPanel.setBorder(BorderFactory.createEmptyBorder(0, JTABPANE_MARGINS, 0, JTABPANE_MARGINS));
    WidgetFactory.setPrefMinSizes(buttonPanel, BUTTON_PANEL_DIMS);
    buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
    mainPanel.add(buttonPanel, java.awt.BorderLayout.SOUTH);

    Color bgColor = StaticGUIResources.getColor("dialogs.mainPanel.bgcolor.r", "dialogs.mainPanel.bgcolor.g",
            "dialogs.mainPanel.bgcolor.b");
    if (bgColor != null) {
        mainPanel.setOpaque(true);
        mainPanel.setBackground(bgColor);
        buttonPanel.setOpaque(true);
        buttonPanel.setBackground(bgColor);
    }

    initButtons();
    buttonPanel.add(Box.createHorizontalGlue());
    buttonPanel.add(okButton);
    buttonPanel.add(WidgetFactory.getDefaultSpacer());
    buttonPanel.add(applyButton);
    buttonPanel.add(WidgetFactory.getDefaultSpacer());
    buttonPanel.add(cancelButton);
    buttonPanel.add(WidgetFactory.getDefaultSpacer());
    buttonPanel.add(helpButton);

}