Example usage for javax.swing Box createVerticalStrut

List of usage examples for javax.swing Box createVerticalStrut

Introduction

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

Prototype

public static Component createVerticalStrut(int height) 

Source Link

Document

Creates an invisible, fixed-height component.

Usage

From source file:org.eobjects.datacleaner.widgets.OpenAnalysisJobFileChooserAccessory.java

public OpenAnalysisJobFileChooserAccessory(WindowContext windowContext,
        AnalyzerBeansConfiguration configuration, DCFileChooser fileChooser,
        Provider<OpenAnalysisJobActionListener> openAnalysisJobActionListenerProvider) {
    super();/* ww  w .  j a  v a 2s . co m*/
    _windowContext = windowContext;
    _configuration = configuration;
    _centerPanel = new DCPanel();
    _centerPanel.setLayout(new VerticalLayout(0));
    _fileChooser = fileChooser;
    _fileChooser.addPropertyChangeListener(this);
    _openJobButton = getOpenJobButton();
    _openAnalysisJobActionListenerProvider = openAnalysisJobActionListenerProvider;

    setPreferredSize(WIDTH, 10);

    setBorder(new EmptyBorder(0, 10, 0, 0));
    setLayout(new BorderLayout());
    setVisible(false);

    final JLabel iconLabel = new JLabel(ICON_APP);

    final JLabel headerLabel = new JLabel("DataCleaner analysis job:");
    headerLabel.setFont(WidgetUtils.FONT_HEADER1);

    final DCPanel northPanel = new DCPanel();
    northPanel.setLayout(new VerticalLayout(0));
    northPanel.add(iconLabel);
    northPanel.add(Box.createVerticalStrut(10));
    northPanel.add(headerLabel);
    northPanel.add(Box.createVerticalStrut(10));
    northPanel.add(_centerPanel);
    northPanel.add(Box.createVerticalStrut(10));

    final DCPanel southPanel = new DCPanel();
    southPanel.setLayout(new VerticalLayout(0));
    northPanel.add(Box.createVerticalStrut(4));
    southPanel.add(_openJobButton);
    southPanel.add(Box.createVerticalStrut(4));
    southPanel.add(getOpenAsTemplateButton());

    add(WidgetUtils.scrolleable(northPanel), BorderLayout.CENTER);
    add(southPanel, BorderLayout.SOUTH);
}

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

/**
 * Creates a new Component with FilterView.
 * @return new Component./*from w w  w .  ja v a  2 s .  com*/
 */
private Component createFilterBox() {
    Box header = Box.createVerticalBox();

    if (filterView != null) {
        header.add(Box.createVerticalStrut(10));
        filterView.refresh();
        header.add(filterView.getPanel());
    }

    header.setAlignmentX(Container.LEFT_ALIGNMENT);

    return header;
}

From source file:org.isatools.gui.optionselector.OptionGroup.java

public void addOptionItem(T item, boolean setSelected) {
    OptionItem<T> option = new OptionItem<T>(setSelected, item);
    option.addMouseListener(this);
    if (!availableOptions.containsKey(item)) {
        availableOptions.put(item, option);
        add(option);//from  w  w w .j a v a 2  s.  c  om
        add(alignment == OptionGroup.HORIZONTAL_ALIGNMENT ? Box.createHorizontalStrut(5)
                : Box.createVerticalStrut(5));
    }
}

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

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

        @Override//from  w  w w .ja  v  a2 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("SpellBooksTop");
    JPanel availPanel = FilterUtilities.configureFilteredTreeViewPane(availableTable, filterBar);
    Box box = Box.createVerticalBox();
    box.add(Box.createVerticalStrut(5));
    {
        Box hbox = Box.createHorizontalBox();
        hbox.add(Box.createHorizontalStrut(5));
        hbox.add(new JLabel(LanguageBundle.getString("InfoSpells.set.auto.book")));
        hbox.add(Box.createHorizontalGlue());
        box.add(hbox);
    }
    box.add(Box.createVerticalStrut(5));
    {
        Box hbox = Box.createHorizontalBox();
        hbox.add(Box.createHorizontalStrut(5));
        hbox.add(defaultBookCombo);
        hbox.add(Box.createHorizontalGlue());
        hbox.add(Box.createHorizontalStrut(5));
        hbox.add(addButton);
        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(5));
    {
        Box hbox = Box.createHorizontalBox();
        hbox.add(Box.createHorizontalStrut(5));
        hbox.add(removeButton);
        hbox.add(Box.createHorizontalGlue());
        box.add(hbox);
    }
    box.add(Box.createVerticalStrut(5));
    upperPane.setRightComponent(box);
    upperPane.setResizeWeight(0);
    setTopComponent(upperPane);

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

From source file:net.sf.mzmine.modules.peaklistmethods.peakpicking.adap3decompositionV2.ADAP3DecompositionV2SetupDialog.java

/** Creates the interface elements */
@Override/*  w w w .j a  v  a 2  s .  c  om*/
protected void addDialogComponents() {
    super.addDialogComponents();

    comboClustersModel = new DefaultComboBoxModel<>();

    PeakList[] peakLists = MZmineCore.getDesktop().getSelectedPeakLists();

    // -----------------------------
    // Panel with preview UI elements
    // -----------------------------

    // Preview CheckBox
    chkPreview = new JCheckBox("Show preview");
    chkPreview.addActionListener(this);
    chkPreview.setHorizontalAlignment(SwingConstants.CENTER);
    chkPreview.setEnabled(peakLists != null && peakLists.length > 0);

    // Preview panel that will contain ComboBoxes
    final JPanel panel = new JPanel(new BorderLayout());
    panel.add(new JSeparator(), BorderLayout.NORTH);
    panel.add(chkPreview, BorderLayout.CENTER);
    panel.add(Box.createVerticalStrut(10), BorderLayout.SOUTH);
    pnlUIElements = new JPanel(new BorderLayout());
    pnlUIElements.add(panel, BorderLayout.NORTH);

    // ComboBox with Clusters
    cboClusters = new JComboBox<>(comboClustersModel);
    cboClusters.setFont(COMBO_FONT);
    cboClusters.addActionListener(this);

    pnlComboBoxes = GUIUtils.makeTablePanel(1, 2, new JComponent[] { new JLabel("Clusters"), cboClusters });

    // --------------------------------------------------------------------
    // ----- Panel with plots --------------------------------------
    // --------------------------------------------------------------------

    pnlPlots = new JPanel();
    pnlPlots.setLayout(new BoxLayout(pnlPlots, BoxLayout.Y_AXIS));

    // Plot with retention-time clusters
    retTimeMZPlot = new SimpleScatterPlot("Retention time", "m/z");
    retTimeMZPlot.setMinimumSize(MIN_DIMENSIONS);

    final JPanel pnlPlotRetTimeClusters = new JPanel(new BorderLayout());
    pnlPlotRetTimeClusters.setBackground(Color.white);
    pnlPlotRetTimeClusters.add(retTimeMZPlot, BorderLayout.CENTER);
    GUIUtils.addMarginAndBorder(pnlPlotRetTimeClusters, 10);

    // Plot with chromatograms
    retTimeIntensityPlot = new EICPlot();
    retTimeIntensityPlot.setMinimumSize(MIN_DIMENSIONS);

    JPanel pnlPlotShapeClusters = new JPanel(new BorderLayout());
    pnlPlotShapeClusters.setBackground(Color.white);
    pnlPlotShapeClusters.add(retTimeIntensityPlot, BorderLayout.CENTER);
    GUIUtils.addMarginAndBorder(pnlPlotShapeClusters, 10);

    pnlPlots.add(pnlPlotRetTimeClusters);
    pnlPlots.add(pnlPlotShapeClusters);

    super.mainPanel.add(pnlUIElements, 0, super.getNumberOfParameters() + 3, 2, 1, 0, 0,
            GridBagConstraints.HORIZONTAL);
}

From source file:com.actelion.research.spiritapp.ui.audit.RecentChangesDlg.java

public RecentChangesDlg(String userId) {
    super(UIUtils.getMainFrame(), "Recent Changes");
    if (userId == null) {
        userTextField.setText("");
        userTextField.setEnabled(true);//from  ww w .  j  a va  2  s.c  om
    } else {
        userTextField.setText(userId.length() == 0 ? "NA" : userId);
        userTextField.setEnabled(false);
    }
    userTextField.setTextWhenEmpty("UserId");

    fromTextField.setText(FormatterUtils.formatDate(DateUtils.addDays(new Date(), -3)));
    toTextField.setText(FormatterUtils.formatDate(DateUtils.addDays(new Date(), 1)));

    //RevisionPanel
    JButton filterButton = new JIconButton(IconType.SEARCH, "Search");
    filterButton.addActionListener(e -> loadRevisions());
    userTextField.addActionListener(e -> loadRevisions());
    //fromTextField.addActionListener(e->loadRevisions());
    //toTextField.addActionListener(e->loadRevisions());
    studyComboBox.addActionListener(e -> loadRevisions());
    byFieldCheckbox.addActionListener(e -> revisionPanel.setSingular(byFieldCheckbox.isSelected()));
    byFieldCheckbox.setVisible(SpiritProperties.getInstance().isAdvancedMode());

    exportChangeEventsAction.setParentDlg(this);
    JIconButton exportChangeEventsButton = new JIconButton(IconType.PDF, "Export Change Events...",
            exportChangeEventsAction);
    JPanel actionPanel = UIUtils.createHorizontalBox(Box.createHorizontalGlue(), exportChangeEventsButton);

    JPanel revisionQueryPanel = UIUtils.createTitleBox("Filters",
            UIUtils.createVerticalBox(
                    UIUtils.createTable(4, new JLabel("From: "), fromTextField, new JLabel(" To: "),
                            toTextField),
                    UIUtils.createHorizontalBox(byFieldCheckbox, Box.createHorizontalGlue()),
                    Box.createVerticalStrut(10), new JSeparator(JSeparator.HORIZONTAL),
                    UIUtils.createHorizontalBox(studyCheckBox, sampleCheckBox, locationCheckBox, resultCheckBox,
                            Box.createHorizontalGlue()),
                    UIUtils.createBox(BorderFactory.createEmptyBorder(10, 10, 10, 0),
                            UIUtils.createTable(2, new JLabel("StudyId: "),
                                    studyComboBox/*,
                                                 new JLabel("UserId: "), userTextField*/)),
                    new JSeparator(JSeparator.HORIZONTAL),
                    UIUtils.createHorizontalBox(adminChanges, Box.createHorizontalGlue()),
                    Box.createVerticalStrut(20), new JSeparator(JSeparator.HORIZONTAL),
                    UIUtils.createHorizontalBox(Box.createHorizontalGlue(), filterButton),
                    Box.createVerticalGlue()));
    getRootPane().setDefaultButton(filterButton);

    if (!SpiritProperties.getInstance().isChecked(PropertyKey.SYSTEM_RESULT)) {
        resultCheckBox.setVisible(false);
        resultCheckBox.setSelected(false);
    }

    //ContentPane
    setContentPane(UIUtils.createBox(revisionPanel, null, actionPanel, revisionQueryPanel, null));
    UIUtils.adaptSize(this, 1200, 800);
    setVisible(true);
}

From source file:net.sf.vfsjfilechooser.accessories.bookmarks.BookmarksManagerPanel.java

public BookmarksManagerPanel(BookmarksDialog parentDialog, VFSJFileChooser chooser) {
    this.parentDialog = parentDialog;
    this.chooser = chooser;

    model = new Bookmarks();

    table = new JTable(model);
    scrollPane = new JScrollPane(table);

    table.setPreferredScrollableViewportSize(tableSize);
    table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);

    bCancel = new JButton(VFSResources.getMessage("VFSJFileChooser.closeButtonText"));

    bOpen = new JButton(VFSResources.getMessage("VFSJFileChooser.openButtonText"));
    bOpen.setIcon(//from w w  w.  j av a2 s .  co  m
            new ImageIcon(getClass().getResource("/net/sf/vfsjfilechooser/plaf/icons/document-open.png")));
    bOpen.setHorizontalAlignment(SwingConstants.LEFT);

    bAdd = new JButton(VFSResources.getMessage("VFSJFileChooser.addButtonText"));
    bAdd.setIcon(new ImageIcon(getClass().getResource("/net/sf/vfsjfilechooser/plaf/icons/list-add.png")));
    bAdd.setHorizontalAlignment(SwingConstants.LEFT);

    bEdit = new JButton(VFSResources.getMessage("VFSJFileChooser.editButtonText"));
    bEdit.setIcon(new ImageIcon(getClass().getResource("/net/sf/vfsjfilechooser/plaf/icons/book_edit.png")));
    bEdit.setHorizontalAlignment(SwingConstants.LEFT);

    bDelete = new JButton(VFSResources.getMessage("VFSJFileChooser.deleteButtonText"));
    bDelete.setIcon(
            new ImageIcon(getClass().getResource("/net/sf/vfsjfilechooser/plaf/icons/list-remove.png")));
    bDelete.setHorizontalAlignment(SwingConstants.LEFT);

    bMoveUp = new JButton(VFSResources.getMessage("VFSJFileChooser.moveUpButtonText"));
    bMoveUp.setIcon(new ImageIcon(getClass().getResource("/net/sf/vfsjfilechooser/plaf/icons/go-up.png")));
    bMoveUp.setHorizontalAlignment(SwingConstants.LEFT);

    bMoveDown = new JButton(VFSResources.getMessage("VFSJFileChooser.moveDownButtonText"));
    bMoveDown.setIcon(new ImageIcon(getClass().getResource("/net/sf/vfsjfilechooser/plaf/icons/go-down.png")));
    bMoveDown.setHorizontalAlignment(SwingConstants.LEFT);

    final ActionHandler ah = new ActionHandler();

    bOpen.addActionListener(ah);
    bCancel.addActionListener(ah);
    bEdit.addActionListener(ah);
    bAdd.addActionListener(ah);
    bDelete.addActionListener(ah);
    bMoveUp.addActionListener(ah);
    bMoveDown.addActionListener(ah);

    final Box south = Box.createHorizontalBox();
    south.add(Box.createHorizontalGlue());
    south.add(bCancel);
    south.add(Box.createHorizontalGlue());

    final JPanel buttons = new JPanel(new GridLayout(0, 1, 5, 5));

    buttons.add(bAdd);
    buttons.add(bEdit);
    buttons.add(bDelete);
    buttons.add(bOpen);
    buttons.add(Box.createVerticalStrut(10));
    buttons.add(bMoveUp);
    buttons.add(bMoveDown);

    JPanel east = new JPanel();
    east.add(buttons, BorderLayout.NORTH);
    east.add(new JPanel(), BorderLayout.CENTER); // don't ask

    setLayout(new BorderLayout(10, 10));

    add(scrollPane, BorderLayout.CENTER);
    add(south, BorderLayout.SOUTH);
    add(east, BorderLayout.EAST);

    setBorder(BorderFactory.createMatteBorder(10, 10, 10, 10, UIManager.getColor("Panel.background")));
}

From source file:org.jdal.swing.TableEditor.java

/**
 * Creates a new Box with table and actions buttons
 * @return a new Box/*  www  .j  a  v a  2s.  com*/
 */
protected Container createTablePanel() {
    table = new JTable(tableModel, tableModel.getTableColumnModel());
    table.setRowHeight(22);
    table.setAutoCreateRowSorter(true);
    tableModel.addTableModelListener(this);
    JScrollPane scroll = new JScrollPane(table);
    scroll.setAlignmentX(Container.LEFT_ALIGNMENT);
    Box box = Box.createVerticalBox();
    JButton addButton = new JButton(new AddAction());
    JButton deleteButton = new JButton(new DeleteAction());
    JButton saveButton = new JButton(new SaveAction());
    JButton refreshButton = new JButton(new RefreshAction());
    Box buttonBox = Box.createHorizontalBox();
    buttonBox.add(addButton);
    buttonBox.add(Box.createHorizontalStrut(5));
    buttonBox.add(deleteButton);
    buttonBox.add(Box.createHorizontalStrut(5));
    buttonBox.add(saveButton);
    buttonBox.add(Box.createHorizontalStrut(5));
    buttonBox.add(refreshButton);
    buttonBox.setAlignmentX(Container.LEFT_ALIGNMENT);
    buttonBox.setMaximumSize(new Dimension(Short.MAX_VALUE, 25));
    box.add(buttonBox);
    box.add(Box.createVerticalStrut(5));
    box.add(scroll);
    return box;
}

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 . c o 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:SimpleDateFormatDemo.java

public SimpleDateFormatDemo() {

    today = new Date();
    availableLocales = new LocaleGroup();

    String[] patternExamples = { "dd MMMMM yyyy", "dd.MM.yy", "MM/dd/yy", "yyyy.MM.dd G 'at' hh:mm:ss z",
            "EEE, MMM d, ''yy", "h:mm a", "H:mm:ss:SSS", "K:mm a,z", "yyyy.MMMMM.dd GGG hh:mm aaa" };

    currentPattern = patternExamples[0];

    // Set up the UI for selecting a pattern.
    JLabel patternLabel1 = new JLabel("Enter the pattern string or");
    JLabel patternLabel2 = new JLabel("select one from the list:");
    patternLabel1.setAlignmentX(Component.LEFT_ALIGNMENT);
    patternLabel2.setAlignmentX(Component.LEFT_ALIGNMENT);

    JComboBox patternList = new JComboBox(patternExamples);
    patternList.setSelectedIndex(0);//w ww  .  j a v a 2s  .  c o m
    patternList.setEditable(true);
    patternList.setAlignmentX(Component.LEFT_ALIGNMENT);
    PatternListener patternListener = new PatternListener();
    patternList.addActionListener(patternListener);

    // Set up the UI for selecting a locale.
    JLabel localeLabel = new JLabel("Select a Locale from the list:");
    localeLabel.setAlignmentX(Component.LEFT_ALIGNMENT);

    JComboBox localeList = new JComboBox(availableLocales.getStrings());
    localeList.setSelectedIndex(0);
    localeList.setAlignmentX(Component.LEFT_ALIGNMENT);
    LocaleListener localeListener = new LocaleListener();
    localeList.addActionListener(localeListener);

    // Create the UI for displaying result
    JLabel resultLabel = new JLabel("Current Date and Time", JLabel.LEFT);
    resultLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
    result = new JLabel(" ");
    result.setForeground(Color.black);
    result.setAlignmentX(Component.LEFT_ALIGNMENT);
    result.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.black),
            BorderFactory.createEmptyBorder(5, 5, 5, 5)));

    // Lay out everything
    JPanel patternPanel = new JPanel();
    patternPanel.setLayout(new BoxLayout(patternPanel, BoxLayout.Y_AXIS));
    patternPanel.add(patternLabel1);
    patternPanel.add(patternLabel2);
    patternPanel.add(patternList);

    JPanel localePanel = new JPanel();
    localePanel.setLayout(new BoxLayout(localePanel, BoxLayout.Y_AXIS));
    localePanel.add(localeLabel);
    localePanel.add(localeList);

    JPanel resultPanel = new JPanel();
    resultPanel.setLayout(new GridLayout(0, 1));
    resultPanel.add(resultLabel);
    resultPanel.add(result);

    setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    patternPanel.setAlignmentX(Component.CENTER_ALIGNMENT);
    localePanel.setAlignmentX(Component.CENTER_ALIGNMENT);
    resultPanel.setAlignmentX(Component.CENTER_ALIGNMENT);

    add(patternPanel);
    add(Box.createVerticalStrut(10));
    add(localePanel);
    add(Box.createVerticalStrut(10));
    add(resultPanel);

    setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    reformat();

}