List of usage examples for javax.swing Box createVerticalStrut
public static Component createVerticalStrut(int height)
From source file:com.googlecode.vfsjfilechooser2.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(new ImageIcon( getClass().getResource("/com/googlecode/vfsjfilechooser2/plaf/icons/document-open.png"))); bOpen.setHorizontalAlignment(SwingConstants.LEFT); bAdd = new JButton(VFSResources.getMessage("VFSJFileChooser.addButtonText")); bAdd.setIcon(/*from w w w.ja va2 s .c o m*/ new ImageIcon(getClass().getResource("/com/googlecode/vfsjfilechooser2/plaf/icons/list-add.png"))); bAdd.setHorizontalAlignment(SwingConstants.LEFT); bEdit = new JButton(VFSResources.getMessage("VFSJFileChooser.editButtonText")); bEdit.setIcon( new ImageIcon(getClass().getResource("/com/googlecode/vfsjfilechooser2/plaf/icons/book_edit.png"))); bEdit.setHorizontalAlignment(SwingConstants.LEFT); bDelete = new JButton(VFSResources.getMessage("VFSJFileChooser.deleteButtonText")); bDelete.setIcon(new ImageIcon( getClass().getResource("/com/googlecode/vfsjfilechooser2/plaf/icons/list-remove.png"))); bDelete.setHorizontalAlignment(SwingConstants.LEFT); bMoveUp = new JButton(VFSResources.getMessage("VFSJFileChooser.moveUpButtonText")); bMoveUp.setIcon( new ImageIcon(getClass().getResource("/com/googlecode/vfsjfilechooser2/plaf/icons/go-up.png"))); bMoveUp.setHorizontalAlignment(SwingConstants.LEFT); bMoveDown = new JButton(VFSResources.getMessage("VFSJFileChooser.moveDownButtonText")); bMoveDown.setIcon( new ImageIcon(getClass().getResource("/com/googlecode/vfsjfilechooser2/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.isatools.isacreator.optionselector.OptionGroup.java
public void addOptionItem(T item, boolean setSelected, ImageIcon selectedImage, ImageIcon unselectedImage, boolean enabled, boolean useStringRepresentation) { OptionItem<T> option = new OptionItem<T>(setSelected, item, selectedImage, unselectedImage, useStringRepresentation);/* ww w.j a v a2 s.c om*/ option.addMouseListener(this); if (!availableOptions.containsKey(item)) { availableOptions.put(item, option); option.setEnabled(enabled); add(option); add(alignment == OptionGroup.HORIZONTAL_ALIGNMENT ? Box.createHorizontalStrut(5) : Box.createVerticalStrut(5)); } }
From source file:net.sf.mzmine.modules.peaklistmethods.peakpicking.adap3decompositionV1_5.ADAP3DecompositionV1_5SetupDialog.java
@Override protected void addDialogComponents() { super.addDialogComponents(); comboPeakList = new JComboBox<>(); comboClustersModel = new DefaultComboBoxModel<>(); comboClusters = new JComboBox<>(comboClustersModel); retTimeMZPlot = new SimpleScatterPlot("Retention time", "m/z"); retTimeIntensityPlot = new EICPlot(); PeakList[] peakLists = MZmineCore.getDesktop().getSelectedPeakLists(); // ----------------------------- // Panel with preview parameters // ----------------------------- preview = new JCheckBox("Show preview"); preview.addActionListener(this); preview.setHorizontalAlignment(SwingConstants.CENTER); if (peakLists == null || peakLists.length == 0) preview.setEnabled(false);//from w w w.j ava 2 s . com else preview.setEnabled(true); final JPanel previewPanel = new JPanel(new BorderLayout()); previewPanel.add(new JSeparator(), BorderLayout.NORTH); previewPanel.add(preview, BorderLayout.CENTER); previewPanel.add(Box.createVerticalStrut(10), BorderLayout.SOUTH); comboPeakList.setFont(COMBO_FONT); for (final PeakList peakList : peakLists) if (peakList.getNumberOfRawDataFiles() == 1) comboPeakList.addItem(peakList); comboPeakList.addActionListener(this); comboClusters.setFont(COMBO_FONT); comboClusters.addActionListener(this); pnlLabelsFields = GUIUtils.makeTablePanel(2, 2, new JComponent[] { new JLabel("Peak list"), comboPeakList, new JLabel("Cluster list"), comboClusters }); pnlVisible = new JPanel(new BorderLayout()); pnlVisible.add(previewPanel, BorderLayout.NORTH); // -------------------------------------------------------------------- // ----- Tabbed panel with plots -------------------------------------- // -------------------------------------------------------------------- // pnlTabs = new JTabbedPane(); pnlTabs = new JPanel(); pnlTabs.setLayout(new BoxLayout(pnlTabs, BoxLayout.Y_AXIS)); retTimeMZPlot.setMinimumSize(MIN_DIMENSIONS); JPanel pnlPlotRetTimeClusters = new JPanel(new BorderLayout()); pnlPlotRetTimeClusters.setBackground(Color.white); pnlPlotRetTimeClusters.add(retTimeMZPlot, BorderLayout.CENTER); GUIUtils.addMarginAndBorder(pnlPlotRetTimeClusters, 10); pnlTabs.add(pnlPlotRetTimeClusters); retTimeIntensityPlot.setMinimumSize(MIN_DIMENSIONS); JPanel pnlPlotShapeClusters = new JPanel(new BorderLayout()); pnlPlotShapeClusters.setBackground(Color.white); pnlPlotShapeClusters.add(retTimeIntensityPlot, BorderLayout.CENTER); GUIUtils.addMarginAndBorder(pnlPlotShapeClusters, 10); pnlTabs.add(pnlPlotShapeClusters); super.mainPanel.add(pnlVisible, 0, super.getNumberOfParameters() + 3, 2, 1, 0, 0, GridBagConstraints.HORIZONTAL); }
From source file:pcgen.gui2.tabs.spells.SpellsPreparedTab.java
private void initComponents() { availableTable.setTreeCellRenderer(spellRenderer); selectedTable.setTreeCellRenderer(spellRenderer); selectedTable.setRowSorter(new SortableTableRowSorter() { @Override//from w w w. ja v a2s .c o 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:org.isatools.isacreator.wizard.AddAssayPane.java
public JComponent createCenterPanel() { JPanel centerPanel = new JPanel(); centerPanel.setLayout(new BoxLayout(centerPanel, BoxLayout.PAGE_AXIS)); centerPanel.setOpaque(false);//from w ww . ja v a 2 s . co m centerPanel.add(Box.createVerticalStrut(15)); String sourceNameFormat = ConfigurationManager.selectTROForUserSelection(MappingObject.STUDY_SAMPLE) .getColumnFormatByName("source name"); String[] arrayDesigns = retrieveArrayDesigns(); for (Assay a : assaysToDefine) { if (a.getTechnologyType().equalsIgnoreCase("dna microarray")) { MicroarrayCreationAlgorithm maAlg = new MicroarrayCreationAlgorithm(study, a, factorsToAdd, treatmentGroups, new TableReferenceObject(ConfigurationManager .selectTROForUserSelection(a.getMeasurementEndpoint(), a.getTechnologyType()) .getTableFields()), up.getInstitution(), sourceNameFormat, arrayDesigns); algorithmsToRun.add(maAlg); centerPanel.add(maAlg); } else { GeneralCreationAlgorithm gca = new GeneralCreationAlgorithm(study, a, factorsToAdd, treatmentGroups, new TableReferenceObject(ConfigurationManager .selectTROForUserSelection(a.getMeasurementEndpoint(), a.getTechnologyType()) .getTableFields()), up.getInstitution(), sourceNameFormat); algorithmsToRun.add(gca); centerPanel.add(gca); } } JScrollPane assayScroller = new JScrollPane(centerPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); assayScroller.setBackground(UIHelper.BG_COLOR); assayScroller.setBorder(null); assayScroller.getViewport().setOpaque(false); assayScroller.getViewport().putClientProperty("EnableWindowBlit", Boolean.TRUE); IAppWidgetFactory.makeIAppScrollPane(assayScroller); return abstractDataEntryEnvironment.getGeneralLayout( new ImageIcon(getClass().getResource("/images/wizard/defineassay.png")), new ImageIcon(getClass().getResource("/images/wizard/BC_4.png")), "Please provide some information about these assays...", assayScroller, getHeight()); }
From source file:com.apatar.ui.JFeatureRequestHelpDialog.java
private void createDialog() { setLayout(new BorderLayout(5, 5)); setSize(400, 400);// w w w.j a v a2 s . co m JPanel textPanel = new JPanel(new BorderLayout(5, 5)); textPanel.setBorder(new EmptyBorder(10, 5, 5, 5)); text.setLineWrap(true); text.setWrapStyleWord(true); text.setFont(UiUtils.NORMAL_SIZE_12_FONT); textPanel.add(new JLabel("What new Apatar features would you like to request? Please describe them:"), BorderLayout.NORTH); textPanel.add(new JScrollPane(text), BorderLayout.CENTER); JPanel contactPanel = new JPanel(); contactPanel.setLayout(new BoxLayout(contactPanel, BoxLayout.Y_AXIS)); JPanel firstNamePanel = new JPanel(); firstNamePanel.setLayout(new BoxLayout(firstNamePanel, BoxLayout.X_AXIS)); firstNamePanel.add(new JLabel("Your First Name:")); firstNamePanel.add(Box.createHorizontalStrut(5)); firstNamePanel.add(firstNameField); JPanel lastNamePanel = new JPanel(); lastNamePanel.setLayout(new BoxLayout(lastNamePanel, BoxLayout.X_AXIS)); lastNamePanel.add(new JLabel("Your Last Name:")); lastNamePanel.add(Box.createHorizontalStrut(5)); lastNamePanel.add(lastNameField); JPanel emailPanel = new JPanel(); emailPanel.setLayout(new BoxLayout(emailPanel, BoxLayout.X_AXIS)); emailPanel.add(new JLabel("Your E-mail:")); emailPanel.add(Box.createHorizontalStrut(28)); emailPanel.add(emailField); contactPanel.add(firstNamePanel); contactPanel.add(Box.createVerticalStrut(5)); contactPanel.add(lastNamePanel); contactPanel.add(Box.createVerticalStrut(5)); contactPanel.add(emailPanel); textPanel.add(contactPanel, BorderLayout.SOUTH); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS)); buttonPanel.add(Box.createHorizontalGlue()); buttonPanel.add(sendButton); buttonPanel.add(Box.createHorizontalStrut(5)); buttonPanel.add(cancel); buttonPanel.add(Box.createHorizontalStrut(5)); buttonPanel.setBorder(new EmptyBorder(0, 0, 5, 0)); getContentPane().add(textPanel, BorderLayout.CENTER); getContentPane().add(buttonPanel, BorderLayout.SOUTH); }
From source file:DecimalFormatDemo.java
public DecimalFormatDemo() { availableLocales = new LocaleGroup(); inputFormatter = NumberFormat.getNumberInstance(); String[] patternExamples = { "##.##", "###,###.##", "##,##,##.##", "#", "000,000.0000", "##.0000", "'hello'###.##" }; currentPattern = patternExamples[0]; // Set up the UI for entering a number. JLabel numberLabel = new JLabel("Enter the number to format:"); numberLabel.setAlignmentX(Component.LEFT_ALIGNMENT); JTextField numberField = new JTextField(); numberField.setEditable(true);/*from w ww .j a v a2s. com*/ numberField.setAlignmentX(Component.LEFT_ALIGNMENT); NumberListener numberListener = new NumberListener(); numberField.addActionListener(numberListener); // 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); 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("Result", 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 numberPanel = new JPanel(); numberPanel.setLayout(new GridLayout(0, 1)); numberPanel.add(numberLabel); numberPanel.add(numberField); 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); numberPanel.setAlignmentX(Component.CENTER_ALIGNMENT); localePanel.setAlignmentX(Component.CENTER_ALIGNMENT); resultPanel.setAlignmentX(Component.CENTER_ALIGNMENT); add(numberPanel); add(Box.createVerticalStrut(10)); add(patternPanel); add(Box.createVerticalStrut(10)); add(localePanel); add(Box.createVerticalStrut(10)); add(resultPanel); setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); reformat(); numberField.setText(result.getText()); }
From source file:com.apatar.ui.JSubmitHelpDialog.java
private void createDialog() { setLayout(new BorderLayout(5, 5)); setSize(400, 400);//from w w w . j a va 2s . c om JPanel textPanel = new JPanel(new BorderLayout(5, 5)); textPanel.setBorder(new EmptyBorder(10, 5, 5, 5)); text.setLineWrap(true); text.setWrapStyleWord(true); text.setFont(UiUtils.NORMAL_SIZE_12_FONT); textPanel.add(new JLabel("If you found a bug, please submit it here:"), BorderLayout.NORTH); textPanel.add(new JScrollPane(text), BorderLayout.CENTER); JPanel contactPanel = new JPanel(); contactPanel.setLayout(new BoxLayout(contactPanel, BoxLayout.Y_AXIS)); JPanel firstNamePanel = new JPanel(); firstNamePanel.setLayout(new BoxLayout(firstNamePanel, BoxLayout.X_AXIS)); firstNamePanel.add(new JLabel("Your First Name:")); firstNamePanel.add(Box.createHorizontalStrut(5)); firstNamePanel.add(firstNameField); JPanel lastNamePanel = new JPanel(); lastNamePanel.setLayout(new BoxLayout(lastNamePanel, BoxLayout.X_AXIS)); lastNamePanel.add(new JLabel("Your Last Name:")); lastNamePanel.add(Box.createHorizontalStrut(5)); lastNamePanel.add(lastNameField); JPanel emailPanel = new JPanel(); emailPanel.setLayout(new BoxLayout(emailPanel, BoxLayout.X_AXIS)); emailPanel.add(new JLabel("Your E-mail:")); emailPanel.add(Box.createHorizontalStrut(28)); emailPanel.add(emailField); contactPanel.add(firstNamePanel); contactPanel.add(Box.createVerticalStrut(5)); contactPanel.add(lastNamePanel); contactPanel.add(Box.createVerticalStrut(5)); contactPanel.add(emailPanel); textPanel.add(contactPanel, BorderLayout.SOUTH); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS)); buttonPanel.add(Box.createHorizontalGlue()); buttonPanel.add(sendButton); buttonPanel.add(Box.createHorizontalStrut(5)); buttonPanel.add(cancel); buttonPanel.add(Box.createHorizontalStrut(5)); buttonPanel.setBorder(new EmptyBorder(0, 0, 5, 0)); getContentPane().add(textPanel, BorderLayout.CENTER); getContentPane().add(buttonPanel, BorderLayout.SOUTH); }
From source file:edu.virginia.speclab.juxta.author.view.export.WebServiceExportDialog.java
/** * Create a UI panel to show export progress *///from w ww . j a v a 2 s . c o m private void createStatusPane() { this.statusPanel = new JPanel(); this.statusPanel.setBackground(Color.white); this.statusPanel.setLayout(new BorderLayout(5, 5)); this.statusPanel.setBorder(BorderFactory.createEmptyBorder(15, 0, 0, 0)); JPanel content = new JPanel(); content.setBackground(Color.white); content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS)); content.add(Box.createVerticalStrut(30)); JLabel l = new JLabel("Status", SwingConstants.CENTER); l.setAlignmentX(CENTER_ALIGNMENT); l.setFont(JuxtaUserInterfaceStyle.LARGE_FONT); content.add(l); content.add(Box.createVerticalStrut(10)); this.statusLabel = new JLabel("", SwingConstants.CENTER); this.statusLabel.setAlignmentX(CENTER_ALIGNMENT); this.setFont(JuxtaUserInterfaceStyle.NORMAL_FONT); content.add(this.statusLabel); this.statusPanel.add(content, BorderLayout.CENTER); JPanel p = new JPanel(); p.setBackground(Color.white); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); p.add(Box.createHorizontalGlue()); this.workAnimation = new JLabel(); this.workAnimation.setIcon(JuxtaUserInterfaceStyle.WORKING_ANIMATION); p.add(this.workAnimation); p.add(Box.createHorizontalGlue()); this.statusPanel.add(p, BorderLayout.NORTH); }
From source file:com.raceup.fsae.test.TesterGui.java
/** * Shows gui to start a test/*from ww w . j a v a 2 s. c om*/ */ private void openQuestionsPanel() { currentSubmissionTimer = new ClockTimer("Current submission time"); // start timer currentSubmissionTimer.start(); totalTestTimer.start(); shuffleQuestions(); testPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10) // title border ); JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS)); panel.add(Box.createVerticalStrut(20)); panel.add(new JScrollPane(testPanel)); panel.add(createTimersPanel()); panel.add(createMonitorPanel()); setContentPane(panel); // scroll pane with questions setPreferredSize(new Dimension(400, 600)); pack(); repaint(); setLocationRelativeTo(null); }