Example usage for javax.swing Box createHorizontalGlue

List of usage examples for javax.swing Box createHorizontalGlue

Introduction

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

Prototype

public static Component createHorizontalGlue() 

Source Link

Document

Creates a horizontal glue component.

Usage

From source file:org.jdal.swing.table.TablePanel.java

public void populateControlBox() {
    if (actions != null) {
        for (Action a : actions) {
            if (a instanceof TablePanelAction)
                ((TablePanelAction) a).setTablePanel((TablePanel<Object>) this);

            JButton b = new JButton(a);
            controlBox.add(b);/*from   w  w w.  jav a  2 s  .c o m*/
            controlBox.add(Box.createHorizontalStrut(5));
        }
    }
    controlBox.add(Box.createHorizontalGlue());
    controlBox.setAlignmentX(Container.LEFT_ALIGNMENT);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    final Box b = Box.createVerticalBox();
    {/*from w  w w  .  java  2s . co 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.stanwood.swing.AboutDialog.java

private void createButtonPane(Box box) {
    Box hBox = Box.createHorizontalBox();
    hBox.add(Box.createHorizontalGlue());
    JButton cmdClose = new JButton(StandardActions.getDialogCloseAction(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            cancel();// w  ww .j av a  2 s . com
        }
    }));
    hBox.add(cmdClose);
    box.add(hBox);

    hBox.setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 5));

    cmdClose.requestFocusInWindow();
}

From source file:uk.nhs.cfh.dsp.yasb.expression.builder.SimpleCloseToUserExpressionPanel.java

/**
 * Inits the components./* ww  w .j a va 2 s  . c  o m*/
 */
public synchronized void initComponents() {

    renderingLabel = new ExpressionRenderingLabel(humanReadableRender);
    renderingLabel.initComponents();

    // create expressionBuilderDialog
    createExpressionBuilderDialog();

    JideButton editButton = new JideButton(new AbstractAction("Edit") {
        public void actionPerformed(ActionEvent e) {
            // display expression builder dialog
            expressionBuilderDialog.setVisible(true);
        }
    });

    // create  panel that displays editing options and button
    JPanel p1 = new JPanel();
    p1.setLayout(new BoxLayout(p1, BoxLayout.LINE_AXIS));
    p1.add((new JLabel("Edit this expression")));
    p1.add(Box.createHorizontalGlue());
    p1.add(editButton);

    // set title and add panels
    setBorder(BorderFactory.createTitledBorder("Contained Expression"));
    setLayout(new BorderLayout());
    add(renderingLabel, BorderLayout.CENTER);
    add(p1, BorderLayout.SOUTH);
}

From source file:com.eviware.soapui.impl.wsdl.panels.teststeps.GroovyScriptStepDesktopPanel.java

private JComponent buildToolbar() {
    JXToolBar toolBar = UISupport.createToolbar();
    JButton runButton = UISupport.createToolbarButton(runAction);
    toolBar.add(runButton);/*www  . ja v  a2  s  .c o  m*/
    toolBar.add(Box.createHorizontalGlue());
    JLabel label = new JLabel("<html>Script is invoked with <code>log</code>, <code>context</code> "
            + "and <code>testRunner</code> variables</html>");
    label.setToolTipText(label.getText());
    label.setMaximumSize(label.getPreferredSize());

    toolBar.add(label);
    toolBar.addRelatedGap();
    toolBar.add(UISupport.createToolbarButton(new ShowOnlineHelpAction(HelpUrls.GROOVYSTEPEDITOR_HELP_URL)));

    componentEnabler.add(runButton);

    return toolBar;
}

From source file:pcgen.gui2.tabs.bio.BiographyInfoPane.java

private void initComponents() {
    setLayout(new GridBagLayout());
    Box vbox = Box.createVerticalBox();

    allButton.setText(LanguageBundle.getString("in_all")); //$NON-NLS-1$
    allButton.setActionCommand(ALL_COMMAND);
    noneButton.setText(LanguageBundle.getString("in_none")); //$NON-NLS-1$
    noneButton.setActionCommand(NONE_COMMAND);

    Box hbox = Box.createHorizontalBox();
    hbox.add(new JLabel(LanguageBundle.getString("in_descCheckItem"))); //$NON-NLS-1$
    hbox.add(Box.createRigidArea(new Dimension(5, 0)));
    hbox.add(allButton);/*from  ww  w . j  a  v  a  2s  .co  m*/
    hbox.add(Box.createRigidArea(new Dimension(3, 0)));
    hbox.add(noneButton);
    vbox.add(hbox);

    itemsPanel.setLayout(new GridBagLayout());
    itemsPanel.setBorder(new EmptyBorder(8, 5, 8, 5));

    vbox.add(Box.createVerticalStrut(10));
    detailsScroll = new JScrollPane(itemsPanel);
    detailsScroll.setPreferredSize(detailsScroll.getMaximumSize());
    detailsScroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    detailsScroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
    detailsScroll.setMinimumSize(new Dimension(600, 0));
    vbox.add(detailsScroll);
    vbox.add(Box.createVerticalStrut(10));

    hbox = Box.createHorizontalBox();
    hbox.add(Box.createHorizontalGlue());
    addCustomItemButton = new JButton();
    hbox.add(addCustomItemButton);
    hbox.add(Box.createHorizontalGlue());
    vbox.add(hbox);
    vbox.add(Box.createVerticalGlue());

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.weightx = 1;
    gbc.fill = GridBagConstraints.VERTICAL;
    gbc.weighty = 1;
    gbc.insets = new Insets(5, 5, 5, 5);
    add(vbox, gbc);
}

From source file:com.diversityarrays.update.UpdateDialog.java

public UpdateDialog(UpdateCheckRequest updateCheckRequest, UpdateCheckContext ctx, long exp_ms) {
    super(updateCheckRequest.owner, Msg.TITLE_UPDATE_CHECK(), ModalityType.APPLICATION_MODAL);

    this.updateCheckRequest = updateCheckRequest;
    this.updateCheckContext = ctx;

    setKDXploreUpdate(null);//w  w  w  . j  av a 2 s.c  o m
    installUpdateAction.setEnabled(false);

    cardPanel.setBorder(new EmptyBorder(20, 20, 20, 20));

    progressBar.setIndeterminate(true);
    cardPanel.add(progressBar, CARD_PROGRESS);
    if (exp_ms > 0) {
        daysToGo = 1 + ChronoUnit.DAYS.between(new Date().toInstant(), new Date(exp_ms).toInstant());
        JPanel tmp = new JPanel(new BorderLayout());
        tmp.add(new JLabel(Msg.HTML_THIS_VERSION_EXPIRES_IN_N_DAYS((int) daysToGo)), BorderLayout.NORTH);
        tmp.add(messageLabel, BorderLayout.CENTER);
        cardPanel.add(tmp, CARD_MESSAGE);
    } else {
        daysToGo = 0;
        cardPanel.add(messageLabel, CARD_MESSAGE);
    }

    cardLayout.show(cardPanel, CARD_PROGRESS);

    Box buttons = Box.createHorizontalBox();
    buttons.add(new JButton(closeAction));
    buttons.add(new JButton(moreAction));
    if (RunMode.getRunMode().isDeveloper()) {
        buttons.add(new JButton(installUpdateAction));
    }
    buttons.add(Box.createHorizontalGlue());
    buttons.add(backupDatabaseButton);
    backupDatabaseButton.setVisible(false);
    backupDatabaseAction.setEnabled(updateCheckContext.canBackupDatabase());

    Container cp = getContentPane();

    cp.add(buttons, BorderLayout.SOUTH);
    cp.add(cardPanel, BorderLayout.CENTER);

    pack();

    GuiUtil.centreOnOwner(this);

    addWindowListener(new WindowAdapter() {
        @Override
        public void windowOpened(WindowEvent e) {
            removeWindowListener(this);
            checkForUpdates(updateCheckContext.getPrintStream());
        }
    });
}

From source file:pcgen.gui2.tabs.spells.SpellsPreparedTab.java

private void initComponents() {
    availableTable.setTreeCellRenderer(spellRenderer);
    selectedTable.setTreeCellRenderer(spellRenderer);
    selectedTable.setRowSorter(new SortableTableRowSorter() {

        @Override/*from  ww w  .j  av  a  2  s  .  co  m*/
        public SortableTableModel getModel() {
            return (SortableTableModel) selectedTable.getModel();
        }

    });
    selectedTable.getRowSorter().toggleSortOrder(0);
    FilterBar<CharacterFacade, SuperNode> filterBar = new FilterBar<>();
    filterBar.addDisplayableFilter(new SearchFilterPanel());
    qFilterButton.setText(LanguageBundle.getString("in_igQualFilter")); //$NON-NLS-1$
    filterBar.addDisplayableFilter(qFilterButton);

    FlippingSplitPane upperPane = new FlippingSplitPane("SpellsPreparedTop");
    JPanel availPanel = FilterUtilities.configureFilteredTreeViewPane(availableTable, filterBar);
    Box box = Box.createVerticalBox();
    box.add(Box.createVerticalStrut(5));
    {
        Box hbox = Box.createHorizontalBox();
        addMMSpellButton.setHorizontalTextPosition(SwingConstants.LEADING);
        hbox.add(addMMSpellButton);
        box.add(hbox);
    }
    box.add(Box.createVerticalStrut(2));
    {
        Box hbox = Box.createHorizontalBox();
        hbox.add(Box.createHorizontalStrut(5));
        hbox.add(slotsBox);
        hbox.add(Box.createHorizontalGlue());
        hbox.add(Box.createHorizontalStrut(10));
        hbox.add(addSpellButton);
        hbox.add(Box.createHorizontalStrut(5));
        box.add(hbox);
    }
    box.add(Box.createVerticalStrut(5));
    availPanel.add(box, BorderLayout.SOUTH);
    upperPane.setLeftComponent(availPanel);

    box = Box.createVerticalBox();
    box.add(new JScrollPane(selectedTable));
    box.add(Box.createVerticalStrut(4));
    {
        Box hbox = Box.createHorizontalBox();
        hbox.add(Box.createHorizontalStrut(5));
        hbox.add(removeSpellButton);
        hbox.add(Box.createHorizontalStrut(10));
        hbox.add(new JLabel(LanguageBundle.getString("InfoPreparedSpells.preparedList")));
        hbox.add(Box.createHorizontalStrut(3));
        hbox.add(spellListField);
        hbox.add(Box.createHorizontalStrut(3));
        hbox.add(addSpellListButton);
        hbox.add(Box.createHorizontalStrut(3));
        hbox.add(removeSpellListButton);
        hbox.add(Box.createHorizontalStrut(5));
        box.add(hbox);
    }
    box.add(Box.createVerticalStrut(5));
    upperPane.setRightComponent(box);
    upperPane.setResizeWeight(0);
    setTopComponent(upperPane);

    FlippingSplitPane bottomPane = new FlippingSplitPane("SpellsPreparedBottom");
    bottomPane.setLeftComponent(spellsPane);
    bottomPane.setRightComponent(classPane);
    setBottomComponent(bottomPane);
    setOrientation(VERTICAL_SPLIT);
}

From source file:uk.nhs.cfh.dsp.srth.desktop.modules.querycreationtreepanel.SimpleCloseToUserExpressionPanel.java

/**
 * Inits the components.//from ww w. j a va2  s  .com
 */
public synchronized void initComponents() {

    renderingLabel = new ExpressionRenderingLabel(humanReadableRender);
    renderingLabel.initComponents();

    // create expressionBuilderDialog
    createExpressionBuilderDialog();

    JideButton editButton = new JideButton(new AbstractAction("Edit") {
        public void actionPerformed(ActionEvent e) {
            // set expression in expressionBuilderPanel
            if (getExpression() != null) {
                expressionBuilderPanel.setCloseToUserExpression(getExpression());
            }
            setActive(true);
            // display expression builder dialog
            expressionBuilderDialog.setVisible(true);
        }
    });

    // create  panel that displays editing options and button
    JPanel p1 = new JPanel();
    p1.setLayout(new BoxLayout(p1, BoxLayout.LINE_AXIS));
    p1.add(Box.createHorizontalGlue());
    p1.add(editButton);

    // set title and add panels
    setBorder(BorderFactory.createTitledBorder("Expression"));
    setLayout(new BorderLayout());
    add(renderingLabel, BorderLayout.CENTER);
    add(p1, BorderLayout.SOUTH);
}