List of usage examples for javax.swing Box createHorizontalGlue
public static Component createHorizontalGlue()
From source file:medsavant.uhn.cancer.SetCommentStatusDialog.java
private JPanel getStatusEditorPanel() { JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); p.add(Box.createHorizontalGlue()); statusIconPanel = new StatusIconPanel(ICON_WIDTH, ICON_HEIGHT, true, parentComment.isApproved(), parentComment.isIncluded(), parentComment.isDeleted()); p.add(statusIconPanel);/*from w w w . ja v a 2 s . c om*/ p.add(Box.createHorizontalGlue()); return p; }
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 ww w . ja v a 2s . c o 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:gate.creole.kea.CorpusImporter.java
protected void initGUIComponents() { setLayout(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); constraints.gridy = 0;/*from www .ja v a 2s . c o m*/ constraints.gridx = GridBagConstraints.RELATIVE; constraints.weightx = 0; constraints.weighty = 0; constraints.fill = GridBagConstraints.BOTH; JPanel inputPanel = new JPanel(new GridBagLayout()); inputPanel.setBorder(BorderFactory.createTitledBorder("Input")); GridBagConstraints constraints2 = new GridBagConstraints(); constraints2.gridy = 0; constraints2.gridx = GridBagConstraints.RELATIVE; constraints2.weighty = 0; constraints2.weightx = 0; constraints2.fill = GridBagConstraints.BOTH; constraints2.insets = new Insets(2, 2, 2, 2); JLabel label = new JLabel("Source directory:"); inputPanel.add(label, constraints2); sourceDirTField = new JTextField(30); inputPanel.add(sourceDirTField, constraints2); JButton openButton = new JButton(new SelectDirectoryAction()); inputPanel.add(openButton, constraints2); constraints2.gridy = 1; label = new JLabel("Extension for text files:"); inputPanel.add(label, constraints2); constraints2.gridwidth = 2; textExtensionTField = new JTextField(".txt"); inputPanel.add(textExtensionTField, constraints2); constraints2.gridwidth = 1; constraints2.gridy = 2; label = new JLabel("Extension for keyphrase files:"); inputPanel.add(label, constraints2); constraints2.gridwidth = 2; keyExtensionTField = new JTextField(".key"); inputPanel.add(keyExtensionTField, constraints2); constraints2.gridwidth = 1; constraints2.gridy = 3; label = new JLabel("Encoding for input files:"); inputPanel.add(label, constraints2); constraints2.gridwidth = 2; encodingTField = new JTextField(""); inputPanel.add(encodingTField, constraints2); constraints2.gridwidth = 1; add(inputPanel, constraints); constraints.weightx = 1; add(Box.createHorizontalGlue(), constraints); constraints.weightx = 0; JPanel outputPanel = new JPanel(); outputPanel.setLayout(new GridBagLayout()); outputPanel.setBorder(BorderFactory.createTitledBorder("Output")); constraints2.gridy = 0; label = new JLabel("Corpus name:"); outputPanel.add(label, constraints2); constraints2.weightx = 1; corpusNameTField = new JTextField("KEA Corpus"); constraints2.weightx = 0; outputPanel.add(corpusNameTField, constraints2); constraints2.gridy = 1; label = new JLabel("Output annotation set:"); outputPanel.add(label, constraints2); constraints2.weightx = 1; annotationSetTField = new JTextField("Key"); constraints2.weightx = 0; outputPanel.add(annotationSetTField, constraints2); constraints2.gridy = 2; label = new JLabel("Keyphrase annotation type:"); outputPanel.add(label, constraints2); constraints2.weightx = 1; annotationTypeTField = new JTextField("Keyphrase"); constraints2.weightx = 0; outputPanel.add(annotationTypeTField, constraints2); constraints.gridy = 1; add(outputPanel, constraints); constraints.gridy = 2; constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.CENTER; add(new JButton(new ImportCorpusAction()), constraints); constraints.gridy = 3; constraints.weighty = 1; add(Box.createVerticalGlue(), constraints); }
From source file:org.ut.biolab.medsavant.client.view.genetics.variantinfo.OtherIndividualsGeneSubInspector.java
@Override protected JPanel getIndividualSummaryPanel(String dnaID) { JPanel outerPanel = new JPanel(); outerPanel.setLayout(new BoxLayout(outerPanel, BoxLayout.Y_AXIS)); //dnaIDVariantMap.get(DNAId) -- all variants within gene corresponding to individual Set<VariantRecord> variantRecords = getVariantRecords(dnaID); Map<Long, Set<VariantRecord>> positionVariantMap = new TreeMap<Long, Set<VariantRecord>>(); for (VariantRecord variantRecord : variantRecords) { //Get all variants at that overlap at that position, regardless of individual. Set<VariantRecord> variantsAtPosition = positionVariantMap.get(variantRecord.getStartPosition()); if (variantsAtPosition == null) { variantsAtPosition = new HashSet<VariantRecord>(); }//from ww w.j a v a 2s .c om variantsAtPosition.add(variantRecord); positionVariantMap.put(variantRecord.getStartPosition(), variantsAtPosition); } for (Map.Entry<Long, Set<VariantRecord>> e : positionVariantMap.entrySet()) { Long pos = e.getKey(); Set<VariantRecord> variantsAtPosition = e.getValue(); for (final VariantRecord variantRecord : variantsAtPosition) { final JPanel rowContainer = new JPanel(); rowContainer.setLayout(new BoxLayout(rowContainer, BoxLayout.Y_AXIS)); final JPanel row = new JPanel(); row.setLayout(new BoxLayout(row, BoxLayout.X_AXIS)); row.setBorder(new EmptyBorder(0, MIDDLE_LEVEL_INDENT, 0, 0)); final JLabel showDetailsButton = ViewUtil .createIconButton(IconFactory.getInstance().getIcon(IconFactory.StandardIcon.EXPAND)); String posStr = NumberFormat.getNumberInstance().format(pos); JLabel rowTitle = new JLabel( " " + variantRecord.getZygosity().name() + " " + variantRecord.getType() + " @ " + posStr); row.add(showDetailsButton); row.add(rowTitle); row.add(Box.createHorizontalGlue()); rowContainer.add(row); outerPanel.add(rowContainer); showDetailsButton.addMouseListener(new MouseAdapter() { private boolean expanded = true; @Override public void mousePressed(MouseEvent me) { if (expanded) { showDetailsButton .setIcon(IconFactory.getInstance().getIcon(IconFactory.StandardIcon.COLLAPSE)); int last_level_indent = MIDDLE_LEVEL_INDENT + IconFactory.getInstance().getIcon(IconFactory.StandardIcon.EXPAND) .getIconWidth() + rowContainer.getFontMetrics(rowContainer.getFont()).charWidth(' '); JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); p.setBorder(new EmptyBorder(0, last_level_indent, 0, 0)); JPanel textPanel = new JPanel(); textPanel.setLayout(new BoxLayout(textPanel, BoxLayout.X_AXIS)); textPanel.add(new JLabel("Ref: " + variantRecord.getRef())); textPanel.add(Box.createHorizontalGlue()); p.add(textPanel); textPanel = new JPanel(); textPanel.setLayout(new BoxLayout(textPanel, BoxLayout.X_AXIS)); textPanel.add(new JLabel("Alt: " + variantRecord.getAlt())); textPanel.add(Box.createHorizontalGlue()); p.add(textPanel); rowContainer.add(p); } else { showDetailsButton .setIcon(IconFactory.getInstance().getIcon(IconFactory.StandardIcon.EXPAND)); rowContainer.removeAll(); rowContainer.add(row); } rowContainer.revalidate(); rowContainer.repaint(); expanded = !expanded; } }); } } return outerPanel; }
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(//w w w . j av a2s . 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:net.sf.housekeeper.swing.MainFrame.java
/** * Builds the menus.//w ww. j av a 2 s . c o m * * @return The created menu bar. Is not null. */ private JMenuBar buildMenuBar() { final JMenuBar menuBar = new JMenuBar(); //File Menu final String fileMenuLabel = LocalisationManager.INSTANCE.getText("gui.menu.file"); final JMenu menuFile = new JMenu(fileMenuLabel); menuBar.add(menuFile); menuFile.add(new JMenuItem(new LoadDataAction())); menuFile.add(new JMenuItem(new SaveDataAction())); menuFile.addSeparator(); menuFile.add(new JMenuItem(new ExitAction())); //Help Menu final String helpMenuString = LocalisationManager.INSTANCE.getText("gui.menu.help"); final JMenu menuHelp = new JMenu(helpMenuString); menuBar.add(Box.createHorizontalGlue()); menuBar.add(menuHelp); menuHelp.add(new JMenuItem(new AboutDialogAction())); return menuBar; }
From source file:medsavant.uhn.cancer.AddNewCommentDialog.java
private JPanel getHeader(String str) { JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); p.add(new JLabel(str)); p.add(Box.createHorizontalGlue()); return p;//from w w w .ja v a 2 s .c om }
From source file:sanger.team16.gui.genevar.eqtl.snp.CisEQTLSNPPane2.java
private void setTranscriptPanel(String variationName, ChartPanel regionalLinePlot) throws ArrayIndexOutOfBoundsException { BaseJPane panel = new BaseJPane(variationName, 10, 20, 10, 20); // ------------------ Panel p0 (start) ------------------ // BaseJPane p0 = new BaseJPane(); p0.add(regionalLinePlot);/* w ww . j a va 2s . c o m*/ //p0.setBaseSpringBoxTrailing(); panel.add(p0); // ------------------ Panel p0 (end) ------------------ // panel.add(new JLabel("")); panel.add(new JLabel("")); panel.add(new JLabel("")); // ------------------ Panel p1 (start) ------------------ // BaseJPane p1 = new BaseJPane(); JButton bSelectAll = new JButton(" Deselect All "); JButton bExport = new JButton(" Export List "); CisSNPPane2Listener cisSNP2Listener = new CisSNPPane2Listener(bSelectAll, bExport); //bSelectAll.setForeground(new Color(34,139,34)); bSelectAll.setForeground(Color.GREEN.darker()); bSelectAll.addActionListener(cisSNP2Listener); p1.add(bSelectAll); bExport.addActionListener(cisSNP2Listener); p1.add(bExport); p1.add(Box.createHorizontalGlue()); this.setLinkToPanel(p1, assemblyId, snp.getChromosome(), snp.getPosition(), distanceToSNP); p1.setBaseSpringBox(); panel.add(p1); // ------------------ Panel p1 (end) ------------------ // // ------------------ Panel p2 (start) ------------------ // //BaseJTable transcriptTable = this.transcriptTable.getSortedTable(); //TODO if (transcriptTable.isEnabled()) { bSelectAll.setEnabled(false); bExport.setEnabled(false); } this.setTranscriptTable(); BaseJPane p2 = new BaseJPane(); p2.setLayout(new BorderLayout()); p2.add(transcriptTable.getTableHeader(), BorderLayout.PAGE_START); p2.add(transcriptTable, BorderLayout.CENTER); //p0.setBaseSpringGrid(1, 1); panel.add(p2); // ------------------ Panel p2 (end) ------------------ // panel.add(new JLabel(" (Use CTRL+C to copy genes of interest)")); panel.setBaseSpringGrid(1); this.add(panel); }
From source file:pcgen.gui2.tabs.DomainInfoTab.java
private void initComponents() { setOrientation(VERTICAL_SPLIT);/*from w w w. j av a2s . c o m*/ JPanel panel = new JPanel(new BorderLayout()); FilterBar bar = new FilterBar(); bar.addDisplayableFilter(new SearchFilterPanel()); deityTable.setDisplayableFilter(bar); panel.add(bar, BorderLayout.NORTH); deityTable.setSortingPriority(Collections.singletonList(new SortingPriority(0, SortMode.ASCENDING))); deityTable.sortModel(); ListSelectionModel selectionModel = deityTable.getSelectionModel(); selectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); panel.add(new JScrollPane(deityTable), BorderLayout.CENTER); Box box = Box.createHorizontalBox(); box.add(Box.createHorizontalGlue()); box.add(new JLabel("Deity:")); box.add(Box.createHorizontalStrut(5)); box.add(selectedDeity); box.add(Box.createHorizontalStrut(5)); box.add(selectDeity); box.add(Box.createHorizontalGlue()); panel.add(box, BorderLayout.SOUTH); FlippingSplitPane splitPane = new FlippingSplitPane(); splitPane.setLeftComponent(panel); panel = new JPanel(new BorderLayout()); bar = new FilterBar(); bar.addDisplayableFilter(new SearchFilterPanel()); domainFilter = bar; panel.add(bar, BorderLayout.NORTH); selectionModel = domainTable.getSelectionModel(); selectionModel.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JScrollPane scrollPane = TableUtils.createCheckBoxSelectionPane(domainTable, domainRowHeaderTable); panel.add(scrollPane, BorderLayout.CENTER); box = Box.createHorizontalBox(); box.add(Box.createHorizontalGlue()); box.add(new JLabel("Domains Remaining to be Selected:")); box.add(Box.createHorizontalStrut(5)); box.add(selectedDomain); box.add(Box.createHorizontalGlue()); panel.add(box, BorderLayout.SOUTH); splitPane.setRightComponent(panel); setTopComponent(splitPane); splitPane = new FlippingSplitPane(); splitPane.setLeftComponent(deityInfo); splitPane.setRightComponent(domainInfo); setBottomComponent(splitPane); setResizeWeight(.65); }
From source file:sanger.team16.gui.genevar.mqtl.snp.CisMQTLSNPPane2.java
private void setMofidicationPanel(String variationName, ChartPanel regionalLinePlot) throws ArrayIndexOutOfBoundsException { BaseJPane panel = new BaseJPane(variationName, 10, 20, 10, 20); // ------------------ Panel p0 (start) ------------------ // BaseJPane p0 = new BaseJPane(); p0.add(regionalLinePlot);//from www. java2s. com //p0.setBaseSpringBoxTrailing(); panel.add(p0); // ------------------ Panel p0 (end) ------------------ // panel.add(new JLabel("")); panel.add(new JLabel("")); panel.add(new JLabel("")); // ------------------ Panel p1 (start) ------------------ // BaseJPane p1 = new BaseJPane(); JButton bSelectAll = new JButton(" Deselect All "); JButton bExport = new JButton(" Export List "); CisSNPPane2Listener cisSNP2Listener = new CisSNPPane2Listener(bSelectAll, bExport); //bSelectAll.setForeground(new Color(34,139,34)); bSelectAll.setForeground(Color.GREEN.darker()); bSelectAll.addActionListener(cisSNP2Listener); p1.add(bSelectAll); bExport.addActionListener(cisSNP2Listener); p1.add(bExport); p1.add(Box.createHorizontalGlue()); this.setLinkToPanel(p1, assemblyId, snp.getChromosome(), snp.getPosition(), distanceToSNP); p1.setBaseSpringBox(); panel.add(p1); // ------------------ Panel p1 (end) ------------------ // // ------------------ Panel p2 (start) ------------------ // //BaseJTable transcriptTable = this.transcriptTable.getSortedTable(); //TODO if (modificationTable.isEnabled()) { bSelectAll.setEnabled(false); bExport.setEnabled(false); } this.setTranscriptTable(); BaseJPane p2 = new BaseJPane(); p2.setLayout(new BorderLayout()); p2.add(modificationTable.getTableHeader(), BorderLayout.PAGE_START); p2.add(modificationTable, BorderLayout.CENTER); //p0.setBaseSpringGrid(1, 1); panel.add(p2); // ------------------ Panel p2 (end) ------------------ // panel.add(new JLabel(" (Use CTRL+C to copy CpG probes of interest)")); panel.setBaseSpringGrid(1); this.add(panel); }