List of usage examples for javax.swing BoxLayout Y_AXIS
int Y_AXIS
To view the source code for javax.swing BoxLayout Y_AXIS.
Click Source Link
From source file:org.o3project.optsdn.don.frame.NeFrame.java
/** * Create a panel that displays Connect button. * //ww w . ja v a2 s .c om * @return The panel that displays Connect button */ private JPanel createConnectButtonPanel() { connectButton = new JButton("Connect"); connectButton.addActionListener(new ConnectToOpenFlowControllerListener(this)); connectButton.setMaximumSize(new Dimension(Short.MAX_VALUE, connectButton.getMaximumSize().height)); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.Y_AXIS)); buttonPanel.add(connectButton); return buttonPanel; }
From source file:org.ohdsi.whiteRabbit.WhiteRabbitMain.java
private JPanel createScanPanel() { JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); JPanel tablePanel = new JPanel(); tablePanel.setLayout(new BorderLayout()); tablePanel.setBorder(new TitledBorder("Tables to scan")); tableList = new JList<String>(); tableList.setToolTipText("Specify the tables (or CSV files) to be scanned here"); tablePanel.add(new JScrollPane(tableList), BorderLayout.CENTER); JPanel tableButtonPanel = new JPanel(); tableButtonPanel.setLayout(new GridLayout(3, 1)); addAllButton = new JButton("Add all in DB"); addAllButton.setToolTipText("Add all tables in the database"); addAllButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { addAllTables();//from w w w. ja v a 2 s .c o m } }); addAllButton.setEnabled(false); tableButtonPanel.add(addAllButton); JButton addButton = new JButton("Add"); addButton.setToolTipText("Add tables to list"); addButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { pickTables(); } }); tableButtonPanel.add(addButton); JButton removeButton = new JButton("Remove"); removeButton.setToolTipText("Remove tables from list"); removeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { removeTables(); } }); tableButtonPanel.add(removeButton); tablePanel.add(tableButtonPanel, BorderLayout.EAST); panel.add(tablePanel, BorderLayout.CENTER); JPanel southPanel = new JPanel(); southPanel.setLayout(new BoxLayout(southPanel, BoxLayout.Y_AXIS)); JPanel scanOptionsPanel = new JPanel(); scanOptionsPanel.setLayout(new BoxLayout(scanOptionsPanel, BoxLayout.X_AXIS)); scanValueScan = new JCheckBox("Scan field values", true); scanValueScan.setToolTipText("Include a frequency count of field values in the scan report"); scanValueScan.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent arg0) { scanMinCellCount.setEnabled(((JCheckBox) arg0.getSource()).isSelected()); scanRowCount.setEnabled(((JCheckBox) arg0.getSource()).isSelected()); scanValuesCount.setEnabled(((JCheckBox) arg0.getSource()).isSelected()); } }); scanOptionsPanel.add(scanValueScan); scanOptionsPanel.add(Box.createHorizontalGlue()); scanOptionsPanel.add(new JLabel("Min cell count ")); scanMinCellCount = new JSpinner(); scanMinCellCount.setValue(5); scanMinCellCount.setToolTipText("Minimum frequency for a field value to be included in the report"); scanOptionsPanel.add(scanMinCellCount); scanOptionsPanel.add(Box.createHorizontalGlue()); scanOptionsPanel.add(new JLabel("Max distinct values ")); scanValuesCount = new JComboBox<String>(new String[] { "100", "1,000", "10,000" }); scanValuesCount.setSelectedIndex(1); scanValuesCount.setToolTipText("Maximum number of distinct values per field to be reported"); scanOptionsPanel.add(scanValuesCount); scanOptionsPanel.add(Box.createHorizontalGlue()); scanOptionsPanel.add(new JLabel("Rows per table ")); scanRowCount = new JComboBox<String>(new String[] { "100,000", "500,000", "1 million", "all" }); scanRowCount.setSelectedIndex(0); scanRowCount.setToolTipText("Maximum number of rows per table to be scanned for field values"); scanOptionsPanel.add(scanRowCount); southPanel.add(scanOptionsPanel); southPanel.add(Box.createVerticalStrut(3)); JPanel scanButtonPanel = new JPanel(); scanButtonPanel.setLayout(new BoxLayout(scanButtonPanel, BoxLayout.X_AXIS)); scanButtonPanel.add(Box.createHorizontalGlue()); JButton scanButton = new JButton("Scan tables"); scanButton.setBackground(new Color(151, 220, 141)); scanButton.setToolTipText("Scan the selected tables"); scanButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { scanRun(); } }); componentsToDisableWhenRunning.add(scanButton); scanButtonPanel.add(scanButton); southPanel.add(scanButtonPanel); panel.add(southPanel, BorderLayout.SOUTH); return panel; }
From source file:org.openmicroscopy.shoola.agents.dataBrowser.view.SearchPanel.java
/** * Builds the UI component hosting the terms to search for. * /*from ww w . j av a 2 s .com*/ * @return See above. */ private JPanel buildSearchFor() { if (searchFor == null) { searchFor = new JPanel(); searchFor.setBackground(UIUtilities.BACKGROUND_COLOR); searchFor.setLayout(new BoxLayout(searchFor, BoxLayout.Y_AXIS)); } searchFor.removeAll(); searchFor.add(buildBasicSearchComp()); return searchFor; }
From source file:org.openmicroscopy.shoola.agents.fsimporter.chooser.FileSelectionTable.java
/** * Builds and lays out the controls./*from w ww .j av a2s. c o m*/ * * @return See above. */ JPanel buildControls() { JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); if (ImporterAgent.runAsPlugin() != LookupNames.IMAGE_J_IMPORT) { p.add(addButton); p.add(Box.createVerticalStrut(5)); } p.add(removeButton); p.add(Box.createVerticalStrut(5)); p.add(removeAllButton); return p; }
From source file:org.openmicroscopy.shoola.agents.fsimporter.chooser.ImportDialog.java
/** * Initializes the components composing the display. * //from ww w . j a v a 2s .co m * @param filters The filters to handle. * @param importerAction The cancel-all-imports action. */ private void initComponents(FileFilter[] filters, ImporterAction importerAction) { canvas = new QuotaCanvas(); sizeImportLabel = new JLabel(); diskSpacePane = new JPanel(); diskSpacePane.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0)); diskSpacePane.add(UIUtilities.setTextFont(TEXT_FREE_SPACE)); diskSpacePane.add(canvas); showThumbnails = new JCheckBox(TEXT_SHOW_THUMBNAILS); showThumbnails.setVisible(false); Registry registry = ImporterAgent.getRegistry(); Boolean loadThumbnails = (Boolean) registry.lookup(LOAD_THUMBNAIL); if (loadThumbnails != null) { if (loadThumbnails.booleanValue()) { showThumbnails.setVisible(true); showThumbnails.setSelected(loadThumbnails.booleanValue()); } } if (!isFastConnection()) // slow connection showThumbnails.setSelected(false); long groupId = -1; if (model.getSelectedGroup() != null) groupId = model.getSelectedGroup().getGroupId(); if (groupId < 0) groupId = ImporterAgent.getUserDetails().getGroupId(); locationDialog = new LocationDialog(owner, selectedContainer, type, objects, model, groupId, true); locationDialog.addPropertyChangeListener(this); int plugin = ImporterAgent.runAsPlugin(); if (plugin == LookupNames.IMAGE_J_IMPORT || plugin == LookupNames.IMAGE_J) { detachedDialog = new LocationDialog(owner, selectedContainer, type, objects, model, groupId, false); detachedDialog.addPropertyChangeListener(this); } tagSelectionListener = new ActionListener() { public void actionPerformed(ActionEvent e) { Object src = e.getSource(); if (src instanceof JButton) { TagAnnotationData tag = tagsMap.get(src); if (tag != null) { tagsMap.remove(src); handleTagsSelection(tagsMap.values()); } } } }; tabbedPane = new JTabbedPane(); numberOfFolders = new NumericalTextField(); numberOfFolders.setMinimum(0); numberOfFolders.setText("0"); numberOfFolders.setColumns(3); numberOfFolders.addPropertyChangeListener(this); tagsMap = new LinkedHashMap<JButton, TagAnnotationData>(); IconManager icons = IconManager.getInstance(); refreshFilesButton = new JButton(TEXT_REFRESH_FILES); refreshFilesButton.setBackground(UIUtilities.BACKGROUND); refreshFilesButton.setToolTipText(TOOLTIP_REFRESH_FILES); refreshFilesButton.setActionCommand("" + CMD_REFRESH_FILES); refreshFilesButton.addActionListener(this); tagButton = new JButton(icons.getIcon(IconManager.PLUS_12)); UIUtilities.unifiedButtonLookAndFeel(tagButton); tagButton.addActionListener(this); tagButton.setActionCommand("" + CMD_TAG); tagButton.setToolTipText(TOOLTIP_ADD_TAGS); tagsPane = new JPanel(); tagsPane.setLayout(new BoxLayout(tagsPane, BoxLayout.Y_AXIS)); overrideName = new JCheckBox(TEXT_OVERRIDE_FILE_NAMING); overrideName.setToolTipText(UIUtilities.formatToolTipText(WARNING)); overrideName.setSelected(true); ButtonGroup group = new ButtonGroup(); fullName = new JRadioButton(TEXT_NAMING_FULL_PATH); group.add(fullName); partialName = new JRadioButton(); partialName.setText(TEXT_NAMING_PARTIAL_PATH); partialName.setSelected(true); group.add(partialName); table = new FileSelectionTable(this); table.addPropertyChangeListener(this); chooser = new GenericFileChooser(); JList list = (JList) UIUtilities.findComponent(chooser, JList.class); KeyAdapter ka = new KeyAdapter() { /** * Adds the files to the import queue. * * @see KeyListener#keyPressed(KeyEvent) */ public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER) { handleEnterKeyPressed(e.getSource()); } } }; if (list != null) list.addKeyListener(ka); if (list == null) { JTable t = (JTable) UIUtilities.findComponent(chooser, JTable.class); if (t != null) t.addKeyListener(ka); } try { File f = UIUtilities.getDefaultFolder(); if (f != null) chooser.setCurrentDirectory(f); } catch (Exception e) { // Ignore: could not set the default container } chooser.addPropertyChangeListener(this); chooser.setMultiSelectionEnabled(true); chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); chooser.setControlButtonsAreShown(false); chooser.setApproveButtonText(TEXT_IMPORT); chooser.setApproveButtonToolTipText(TOOLTIP_IMPORT); bioFormatsFileFilters = new ArrayList<FileFilter>(); if (filters != null) { chooser.setAcceptAllFileFilterUsed(false); for (FileFilter fileFilter : filters) { if (fileFilter instanceof ComboFileFilter) { bioFormatsFileFiltersCombined = fileFilter; ComboFileFilter comboFilter = (ComboFileFilter) fileFilter; FileFilter[] extensionFilters = comboFilter.getFilters(); for (FileFilter combinedFilter : extensionFilters) { bioFormatsFileFilters.add(combinedFilter); } break; } } chooser.addChoosableFileFilter(bioFormatsFileFiltersCombined); for (FileFilter fileFilter : bioFormatsFileFilters) { chooser.addChoosableFileFilter(fileFilter); } chooser.setFileFilter(bioFormatsFileFiltersCombined); } else { chooser.setAcceptAllFileFilterUsed(true); } closeButton = new JButton(TEXT_CLOSE); closeButton.setToolTipText(TOOLTIP_CLOSE); closeButton.setActionCommand("" + CMD_CLOSE); closeButton.addActionListener(this); cancelImportButton = new JButton(importerAction); importerAction.setEnabled(false); importButton = new JButton(TEXT_IMPORT); importButton.setToolTipText(TOOLTIP_IMPORT); importButton.setActionCommand("" + CMD_IMPORT); importButton.addActionListener(this); importButton.setEnabled(false); pixelsSize = new ArrayList<NumericalTextField>(); NumericalTextField field; for (int i = 0; i < 3; i++) { field = new NumericalTextField(); field.setNumberType(Double.class); field.setColumns(2); pixelsSize.add(field); } List<Component> boxes = UIUtilities.findComponents(chooser, JComboBox.class); if (boxes != null) { JComboBox box; JComboBox filterBox = null; Iterator<Component> i = boxes.iterator(); while (i.hasNext()) { box = (JComboBox) i.next(); Object o = box.getItemAt(0); if (o instanceof FileFilter) { filterBox = box; break; } } if (filterBox != null) { filterBox.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e) { String value = KeyEvent.getKeyText(e.getKeyCode()); JComboBox box = (JComboBox) e.getSource(); int n = box.getItemCount(); FileFilter filter; FileFilter selectedFilter = null; String d; for (int j = 0; j < n; j++) { filter = (FileFilter) box.getItemAt(j); d = filter.getDescription(); if (d.startsWith(value)) { selectedFilter = filter; break; } } if (selectedFilter != null) box.setSelectedItem(selectedFilter); } }); } } }
From source file:org.openmicroscopy.shoola.agents.fsimporter.chooser.ImportDialog.java
/** * Builds and lays out the pixels size options. * /* w ww . j a va2 s . c o m*/ * @return See above. */ private JPanel buildPixelSizeComponent() { JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); p.setBorder(BorderFactory.createTitledBorder("Pixels Size Defaults")); JLabel l = new JLabel(); l.setText("Used if no values included in the file:"); p.add(UIUtilities.buildComponentPanel(l)); JPanel row = new JPanel(); row.setLayout(new FlowLayout(FlowLayout.LEFT)); l = new JLabel(); l.setText("X: "); row.add(l); row.add(pixelsSize.get(0)); l = new JLabel(); l.setText("Y: "); row.add(l); row.add(pixelsSize.get(1)); l = new JLabel(); l.setText("Z: "); row.add(l); row.add(pixelsSize.get(2)); p.add(row); return UIUtilities.buildComponentPanel(p); }
From source file:org.openmicroscopy.shoola.agents.fsimporter.chooser.ImportDialog.java
/** * Builds and lays out the components displaying the naming options. * /* w ww .j av a 2 s.c om*/ * @return See above. */ private JComponent buildNamingComponent() { JPanel content = new JPanel(); content.setBorder(BorderFactory.createTitledBorder("File Naming")); JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); panel.add(fullName); panel.add(partialName); JPanel pp = new JPanel(); pp.setLayout(new BoxLayout(pp, BoxLayout.Y_AXIS)); pp.add(UIUtilities.buildComponentPanel(panel)); pp.add(buildPathComponent()); GridBagConstraints c = new GridBagConstraints(); content.setLayout(new GridBagLayout()); c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 0.0; c.gridwidth = 2; c.gridx = 0; c.gridy = 0; content.add(overrideName, c); c.gridwidth = 1; c.gridy++; content.add(Box.createHorizontalStrut(15), c); c.gridx++; content.add(pp, c); JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); p.add(content); p.add(buildAnnotationComponent()); return UIUtilities.buildComponentPanel(p); }
From source file:org.openmicroscopy.shoola.agents.fsimporter.chooser.ImportDialog.java
/** * Builds the component hosting the controls to add annotations. * /*from www. jav a 2 s . co m*/ * @return See above. */ private JPanel buildAnnotationComponent() { JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); JLabel l = new JLabel(); l.setText("Add tag to images"); JPanel tagPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); tagPanel.add(l); tagPanel.add(tagButton); l = new JLabel(); l.setText(": "); tagPanel.add(l); tagPanel.add(tagsPane); p.add(tagPanel); return UIUtilities.buildComponentPanel(p); }
From source file:org.openmicroscopy.shoola.agents.fsimporter.chooser.ImportDialog.java
/** Builds and lays out the UI. */ private void buildGUI() { setLayout(new BorderLayout(0, 0)); JPanel p = new JPanel(); p.setBorder(null);//from ww w . ja v a 2s.c o m p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); p.add(buildQuotaPane()); p.add(table); tabbedPane.add("Files to import", p); tabbedPane.add("Options", buildOptionsPane()); double[][] tablePanelDesign = { { TableLayout.PREFERRED, 10, 5, TableLayout.FILL }, { TableLayout.PREFERRED, TableLayout.FILL } }; JPanel tablePanel = new JPanel(new TableLayout(tablePanelDesign)); tablePanel.add(table.buildControls(), "0, 1, LEFT, CENTER"); tablePanel.add(tabbedPane, "2, 1, 3, 1"); int plugin = ImporterAgent.runAsPlugin(); JSplitPane pane; if (plugin == LookupNames.IMAGE_J_IMPORT || plugin == LookupNames.IMAGE_J) { JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); JLabel label = UIUtilities.setTextFont("Select where to import the image(s)."); panel.add(UIUtilities.buildComponentPanel(label)); panel.add(locationDialog.getContentPane()); pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, panel, tablePanel); } else { pane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, chooser, tablePanel); } JPanel mainPanel = new JPanel(); double[][] mainPanelDesign = { { TableLayout.FILL }, { TableLayout.PREFERRED, TableLayout.FILL } }; mainPanel.setLayout(new TableLayout(mainPanelDesign)); mainPanel.setBackground(UIUtilities.BACKGROUND); mainPanel.add(pane, "0, 1"); this.add(mainPanel, BorderLayout.CENTER); JPanel controls = new JPanel(); controls.setLayout(new BoxLayout(controls, BoxLayout.Y_AXIS)); // Lays out the buttons. JPanel bar = new JPanel(); bar.setLayout(new BoxLayout(bar, BoxLayout.X_AXIS)); bar.add(buildToolBarLeft()); bar.add(buildToolBarRight()); controls.add(new JSeparator()); controls.add(bar); add(controls, BorderLayout.SOUTH); if (JDialog.isDefaultLookAndFeelDecorated()) { boolean supportsWindowDecorations = UIManager.getLookAndFeel().getSupportsWindowDecorations(); if (supportsWindowDecorations) getRootPane().setWindowDecorationStyle(JRootPane.FILE_CHOOSER_DIALOG); } }
From source file:org.openmicroscopy.shoola.agents.fsimporter.util.FileImportComponent.java
/** * Lays out the entries./*from ww w .j a v a 2 s. com*/ * * @param failure Pass <code>true</code> to display the failed import only, * <code>false</code> to display all the entries. */ public void layoutEntries(boolean failure) { JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); p.setBorder(BorderFactory.createLineBorder(Color.BLACK)); if (!hasComponents()) return; Entry<File, FileImportComponent> e; Iterator<Entry<File, FileImportComponent>> i = components.entrySet().iterator(); int index = 0; FileImportComponent fc; if (failure) { while (i.hasNext()) { e = i.next(); fc = e.getValue(); if (fc.hasImportFailed()) { if (index % 2 == 0) fc.setBackground(UIUtilities.BACKGROUND_COLOUR_EVEN); else fc.setBackground(UIUtilities.BACKGROUND_COLOUR_ODD); p.add(fc); index++; } } } else { while (i.hasNext()) { e = i.next(); fc = e.getValue(); if (index % 2 == 0) fc.setBackground(UIUtilities.BACKGROUND_COLOUR_EVEN); else fc.setBackground(UIUtilities.BACKGROUND_COLOUR_ODD); p.add(fc); index++; } } pane.removeAll(); pane.add(p); pane.revalidate(); pane.repaint(); }