List of usage examples for javax.swing Box createHorizontalGlue
public static Component createHorizontalGlue()
From source file:com.idealista.solrmeter.view.statistic.PieChartPanel.java
private Component createCustomizePanel() { JButton jButtonCustomize = new JButton(I18n.get("statistic.pieChartPanel.customize")); jButtonCustomize.addActionListener(new ActionListener() { @Override/*from w w w .ja v a2 s . com*/ public void actionPerformed(ActionEvent e) { JDialogCustomizePieChart dialog = new JDialogCustomizePieChart(SolrMeterMain.mainFrame, timeRangeStatistic); dialog.setVisible(true); } }); JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.LINE_AXIS)); panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 10, 10)); panel.add(Box.createHorizontalGlue()); panel.add(jButtonCustomize); return panel; }
From source file:savant.plugin.builtin.SavantFileRepositoryBrowser.java
private SavantFileRepositoryBrowser(Window parent) { super(parent, "Public Savant File Repository Browser", Dialog.ModalityType.APPLICATION_MODAL); setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE); setResizable(true);/* w w w.j av a2 s .co m*/ setLayout(new BorderLayout()); add(getCenterPanel(getDownloadTreeRows()), BorderLayout.CENTER); JMenuBar bottombar = new JMenuBar(); bottombar.setAlignmentX(RIGHT_ALIGNMENT); bottombar.add(Box.createHorizontalGlue()); JButton openbutt = new JButton("Load Track"); openbutt.putClientProperty("JButton.buttonType", "default"); openbutt.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { actOnSelectedItem(false); } }); bottombar.add(openbutt); JButton cancelButton = new JButton("Cancel"); cancelButton.putClientProperty("JButton.buttonType", "default"); cancelButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { closeDialog(); } }); bottombar.add(cancelButton); add(bottombar, BorderLayout.SOUTH); setPreferredSize(new Dimension(800, 500)); pack(); setLocationRelativeTo(parent); }
From source file:com.haulmont.cuba.desktop.gui.components.DesktopPopupButton.java
public DesktopPopupButton() { popup = new JPopupMenu(); impl = new JButton(); impl.setLayout(new BoxLayout(impl, BoxLayout.X_AXIS)); captionLabel = new JLabel(); impl.add(Box.createHorizontalGlue()); impl.add(captionLabel);// ww w . ja v a 2s . c o m captionLabel.setAlignmentX(CENTER_ALIGNMENT); rightIcon = new JLabel(); rightIcon.setIcon(resources.getIcon(DROP_DOWN_ICON)); rightIcon.setAlignmentX(CENTER_ALIGNMENT); impl.add(rightIcon); impl.add(Box.createHorizontalGlue()); impl.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (popup.isVisible()) popup.setVisible(false); else showPopup(); } }); DesktopComponentsHelper.adjustSize(impl); }
From source file:com.diversityarrays.wizard.WizardRunner.java
protected void handleWizardEnded(WizardEndedReason reason) { if (handler != null) { handler.execute(reason);/*from w w w.j av a2 s.co m*/ } status.setText(reason.toString()); WizardRunner.this.setEnabled(false); RootPaneContainer rpc = ((RootPaneContainer) window); rpc.getContentPane().remove(this); Container cp = rpc.getContentPane(); cp.removeAll(); JLabel label = new JLabel(reason.toString()); Box n = Box.createHorizontalBox(); n.add(Box.createHorizontalGlue()); n.add(label); n.add(Box.createHorizontalGlue()); cp.add(n, BorderLayout.CENTER); Box box = Box.createHorizontalBox(); box.add(Box.createHorizontalGlue()); box.add(new JButton(closeMe)); box.add(Box.createHorizontalStrut(20)); cp.add(box, BorderLayout.SOUTH); cp.setBackground(Color.LIGHT_GRAY); Dimension d = window.getSize(); ++d.width; window.setSize(d); }
From source file:gda.util.userOptions.UserOptionsDialog.java
/** * @param frame// w w w .j a v a2 s. c o m * @param parent * @param options */ public UserOptionsDialog(JFrame frame, Component parent, UserOptions options) { super(frame, options.title, true); this.frame = frame; this.options = options; JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); label = new JLabel(options.title != null ? options.title : ""); label.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); label.setAlignmentX(Component.CENTER_ALIGNMENT); JPanel pane = makePane(); // pane.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); pane.setAlignmentX(Component.CENTER_ALIGNMENT); // pane.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); panel.add(label); panel.add(pane); JPanel btnPanel = new JPanel(); btnPanel.setLayout(new BoxLayout(btnPanel, BoxLayout.X_AXIS)); JButton okButton = new JButton("OK"); okButton.addActionListener(this); JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(this); JButton defButton = new JButton("Default"); defButton.addActionListener(this); JButton resetButton = new JButton("Reset"); resetButton.addActionListener(this); btnPanel.add(Box.createHorizontalGlue()); btnPanel.add(okButton); btnPanel.add(Box.createHorizontalGlue()); btnPanel.add(cancelButton); btnPanel.add(Box.createHorizontalGlue()); btnPanel.add(defButton); btnPanel.add(Box.createHorizontalGlue()); btnPanel.add(resetButton); btnPanel.add(Box.createHorizontalGlue()); btnPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); panel.add(btnPanel); getContentPane().add(panel); getRootPane().setDefaultButton(cancelButton); pack(); setLocationRelativeTo(parent); setVisible(true); setDefaultCloseOperation(DISPOSE_ON_CLOSE); }
From source file:net.sf.mzmine.modules.visualization.ida.IDABottomPanel.java
IDABottomPanel(IDAVisualizerWindow masterFrame, RawDataFile dataFile, ParameterSet parameters) { this.dataFile = dataFile; this.masterFrame = masterFrame; setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); setBackground(Color.white);/* w w w . j av a 2s . c om*/ setBorder(new EmptyBorder(5, 5, 5, 0)); add(Box.createHorizontalGlue()); GUIUtils.addLabel(this, "Show: ", SwingConstants.RIGHT); thresholdCombo = new JComboBox<Object>(PeakThresholdMode.values()); thresholdCombo.setSelectedItem(PeakThresholdMode.NONE); thresholdCombo.setBackground(Color.white); thresholdCombo.setFont(smallFont); thresholdCombo.addActionListener(this); add(thresholdCombo); JPanel peakThresholdPanel = new JPanel(); peakThresholdPanel.setBackground(Color.white); peakThresholdPanel.setLayout(new BoxLayout(peakThresholdPanel, BoxLayout.X_AXIS)); GUIUtils.addLabel(peakThresholdPanel, "Value: ", SwingConstants.RIGHT); peakTextField = new JTextField(); peakTextField.setPreferredSize(new Dimension(50, 15)); peakTextField.setFont(smallFont); peakTextField.addActionListener(this); peakThresholdPanel.add(peakTextField); add(peakThresholdPanel); GUIUtils.addLabel(this, " from peak list: ", SwingConstants.RIGHT); peakListSelector = new JComboBox<PeakList>(); peakListSelector.setBackground(Color.white); peakListSelector.setFont(smallFont); peakListSelector.addActionListener(masterFrame); peakListSelector.setActionCommand("PEAKLIST_CHANGE"); add(peakListSelector); thresholdSettings = parameters.getParameter(IDAParameters.peakThresholdSettings); thresholdCombo.setSelectedItem(thresholdSettings.getMode()); add(Box.createHorizontalStrut(10)); add(Box.createHorizontalGlue()); }
From source file:net.sf.mzmine.modules.visualization.msms.MsMsBottomPanel.java
MsMsBottomPanel(MsMsVisualizerWindow masterFrame, RawDataFile dataFile, ParameterSet parameters) { this.dataFile = dataFile; this.masterFrame = masterFrame; setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); setBackground(Color.white);// ww w . j av a 2 s . c o m setBorder(new EmptyBorder(5, 5, 5, 0)); add(Box.createHorizontalGlue()); GUIUtils.addLabel(this, "Show: ", SwingConstants.RIGHT); thresholdCombo = new JComboBox<Object>(PeakThresholdMode.values()); thresholdCombo.setSelectedItem(PeakThresholdMode.NONE); thresholdCombo.setBackground(Color.white); thresholdCombo.setFont(smallFont); thresholdCombo.addActionListener(this); add(thresholdCombo); JPanel peakThresholdPanel = new JPanel(); peakThresholdPanel.setBackground(Color.white); peakThresholdPanel.setLayout(new BoxLayout(peakThresholdPanel, BoxLayout.X_AXIS)); GUIUtils.addLabel(peakThresholdPanel, "Value: ", SwingConstants.RIGHT); peakTextField = new JTextField(); peakTextField.setPreferredSize(new Dimension(50, 15)); peakTextField.setFont(smallFont); peakTextField.addActionListener(this); peakThresholdPanel.add(peakTextField); add(peakThresholdPanel); GUIUtils.addLabel(this, " from peak list: ", SwingConstants.RIGHT); peakListSelector = new JComboBox<PeakList>(); peakListSelector.setBackground(Color.white); peakListSelector.setFont(smallFont); peakListSelector.addActionListener(masterFrame); peakListSelector.setActionCommand("PEAKLIST_CHANGE"); add(peakListSelector); thresholdSettings = parameters.getParameter(MsMsParameters.peakThresholdSettings); thresholdCombo.setSelectedItem(thresholdSettings.getMode()); add(Box.createHorizontalStrut(10)); add(Box.createHorizontalGlue()); }
From source file:be.ac.ua.comp.scarletnebula.gui.TaggingPanel.java
public TaggingPanel(final Collection<String> initialTags) { super(new BorderLayout()); for (final String tag : initialTags) { taglist.addTag(new TagItem(tag)); }// w w w .ja va2 s . c o m final BetterTextField inputField = new BetterTextField(); addTagActionListener = new AddTagActionListener(inputField); inputField.addActionListener(addTagActionListener); final String hint = "Type a tag and press enter"; inputField.setPlaceHolder(hint); inputField.setToolTipText(hint); inputField.setInputVerifier(new TagInputVerifier(inputField)); inputField.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0), BorderFactory.createBevelBorder(BevelBorder.LOWERED))); taglist.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); final JScrollPane tagScrollPane = new JScrollPane(taglist); tagScrollPane.setBorder(null); final JPanel centerPanel = new JPanel(new BorderLayout()); centerPanel.add(inputField, BorderLayout.NORTH); centerPanel.add(tagScrollPane, BorderLayout.CENTER); centerPanel.setMaximumSize(new Dimension(250, 500)); centerPanel.setPreferredSize(new Dimension(200, 200)); setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS)); add(Box.createHorizontalGlue()); add(centerPanel); add(Box.createHorizontalGlue()); }
From source file:be.ac.ua.comp.scarletnebula.gui.DecoratedCommunicationPanel.java
final public void clearAndFill(final Collection<Server> selectedServers) { // Remove all components on there invalidate();/*from ww w . j a v a 2 s .co m*/ removeAll(); setLayout(new BorderLayout()); // If there are no servers, or none of the servers are running, do not // display the ssh console final Collection<Server> connectableServers = new ArrayList<Server>(); for (final Server s : selectedServers) { if (s.getStatus() == VmState.RUNNING && s.getPublicDnsAddress() != null) { connectableServers.add(s); } } // If there are no servers to connect to, don't draw the ssh console if (connectableServers.size() == 0) { log.info("Connection tab clicked and no servers selected to connect to."); final BetterTextLabel txt = new BetterTextLabel( "Please select at least one running server to connect to."); txt.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 20)); add(txt, BorderLayout.CENTER); validate(); repaint(); } else { final Server connectServer = selectedServers.iterator().next(); final JPanel propertiesPanel = new JPanel(); propertiesPanel.setLayout(new BoxLayout(propertiesPanel, BoxLayout.LINE_AXIS)); propertiesPanel.add(Box.createHorizontalGlue()); final JButton propertiesButton = new JButton("Properties", Utils.icon("modify16.png")); propertiesButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { final ChangeServerSshLoginMethodWindow win = new ChangeServerSshLoginMethodWindow(parent, connectServer); win.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { clearAndFill(selectedServers); } }); win.setVisible(true); } }); final JButton restartButton = new JButton("Restart connection", Utils.icon("undo16.png")); restartButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { clearAndFill(selectedServers); } }); propertiesPanel.add(restartButton); propertiesPanel.add(Box.createHorizontalStrut(10)); propertiesPanel.add(propertiesButton); propertiesPanel.add(Box.createHorizontalStrut(20)); propertiesPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 0, 0)); add(propertiesPanel, BorderLayout.NORTH); final SSHPanel sshPanel = new SSHPanel(connectServer); sshPanel.setBorder(BorderFactory.createEmptyBorder(5, 20, 10, 20)); add(sshPanel, BorderLayout.CENTER); validate(); repaint(); } }
From source file:org.stanwood.swing.AboutDialog.java
public void init() { Box box = Box.createVerticalBox(); if (icon == null) { createTitleArea(box, title, version); } else {// w w w . j av a 2s .com Box hbox = Box.createHorizontalBox(); hbox.add(Box.createHorizontalStrut(40)); hbox.add(new JLabel(icon)); hbox.add(Box.createHorizontalStrut(10)); box.add(hbox); Box vbox = Box.createVerticalBox(); createTitleArea(vbox, title, version); hbox.add(vbox); hbox.add(Box.createHorizontalGlue()); } JTabbedPane infoTabbedPane = new JTabbedPane(); infoTabbedPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JComponent tabAbout = createAboutTab(); infoTabbedPane.addTab("About", tabAbout); JComponent tabAuthors = createAuthorsTab(); infoTabbedPane.addTab("Authors", tabAuthors); box.add(infoTabbedPane); createButtonPane(box); setContentPane(box); setSize(450, 280); setLocationRelativeTo(getParent()); }