List of usage examples for javax.swing JSeparator JSeparator
public JSeparator(int orientation)
From source file:com.sshtools.powervnc.PowerVNCFullScreenWindowContainer.java
public void init(final SshToolsApplication application, SshToolsApplicationPanel panel) throws SshToolsApplicationException { getContentPane().invalidate();/*from w w w.j a va2 s .c o m*/ //setUndecorated(true); this.panel = panel; this.application = application; setJMenuBar(((PowerVNCPanel) panel).getJMenuBar()); // We dont want the status bar, menu bar or tool bar showing in full screen mode by default ((PowerVNCPanel) panel).setToolsVisible(false); panel.registerActionMenu(new SshToolsApplicationPanel.ActionMenu("File", "File", 'f', 0)); panel.registerAction(exitAction = new ExitAction(application, this)); panel.registerAction(newWindowAction = new NewWindowAction(application)); panel.registerAction(aboutAction = new AboutAction(this, application)); panel.registerAction(fullScreenAction = new FullScreenActionImpl(application, this)); getApplicationPanel().rebuildActionComponents(); JPanel p = new JPanel(new BorderLayout()); if (panel.getToolBar() != null) { JPanel t = new JPanel(new BorderLayout()); t.add(panel.getToolBar(), BorderLayout.NORTH); t.add(toolSeperator = new JSeparator(JSeparator.HORIZONTAL), BorderLayout.SOUTH); final SshToolsApplicationPanel pnl = panel; panel.getToolBar().addComponentListener(new ComponentAdapter() { public void componentHidden(ComponentEvent evt) { log.debug("Tool separator is now " + pnl.getToolBar().isVisible()); toolSeperator.setVisible(pnl.getToolBar().isVisible()); } }); p.add(t, BorderLayout.NORTH); } p.add(panel, BorderLayout.CENTER); if (panel.getStatusBar() != null) { p.add(panel.getStatusBar(), BorderLayout.SOUTH); } getContentPane().setLayout(new GridLayout(1, 1)); getContentPane().add(p); // Watch for the frame closing addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent evt) { application.closeContainer(PowerVNCFullScreenWindowContainer.this); } }); getContentPane().validate(); }
From source file:ListDemo.java
public ListDemo() { super(new BorderLayout()); listModel = new DefaultListModel(); listModel.addElement("Debbie Scott"); listModel.addElement("Scott Hommel"); listModel.addElement("Sharon Zakhour"); // Create the list and put it in a scroll pane. list = new JList(listModel); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list.setSelectedIndex(0);/* ww w . jav a2 s .c o m*/ list.addListSelectionListener(this); list.setVisibleRowCount(5); JScrollPane listScrollPane = new JScrollPane(list); JButton hireButton = new JButton(hireString); HireListener hireListener = new HireListener(hireButton); hireButton.setActionCommand(hireString); hireButton.addActionListener(hireListener); hireButton.setEnabled(false); fireButton = new JButton(fireString); fireButton.setActionCommand(fireString); fireButton.addActionListener(new FireListener()); employeeName = new JTextField(10); employeeName.addActionListener(hireListener); employeeName.getDocument().addDocumentListener(hireListener); String name = listModel.getElementAt(list.getSelectedIndex()).toString(); // Create a panel that uses BoxLayout. JPanel buttonPane = new JPanel(); buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS)); buttonPane.add(fireButton); buttonPane.add(Box.createHorizontalStrut(5)); buttonPane.add(new JSeparator(SwingConstants.VERTICAL)); buttonPane.add(Box.createHorizontalStrut(5)); buttonPane.add(employeeName); buttonPane.add(hireButton); buttonPane.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); add(listScrollPane, BorderLayout.CENTER); add(buttonPane, BorderLayout.PAGE_END); }
From source file:com.floreantpos.ui.views.LoginView.java
private LoginView() { setLayout(new BorderLayout(5, 5)); width = PosUIManager.getSize(600);/*from w w w. j av a2 s .c o m*/ height = PosUIManager.getSize(100); centerPanel.setLayout(new MigLayout("al center center", "sg fill", String.valueOf(height))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ JLabel titleLabel = new JLabel(IconFactory.getIcon("/ui_icons/", "title.png")); //$NON-NLS-1$ //$NON-NLS-2$ titleLabel.setOpaque(true); titleLabel.setBackground(Color.WHITE); JPanel panel = new JPanel(new BorderLayout()); panel.add(titleLabel, BorderLayout.CENTER); panel.add(new JSeparator(JSeparator.HORIZONTAL), BorderLayout.SOUTH); add(panel, BorderLayout.NORTH); add(createCenterPanel(), BorderLayout.CENTER); }
From source file:com.sshtools.sshvnc.SshVncFullScreenWindowContainer.java
public void init(final SshToolsApplication application, SshToolsApplicationPanel panel) throws SshToolsApplicationException { getContentPane().invalidate();/*w ww . j ava2 s. c o m*/ //setUndecorated(true); this.panel = panel; this.application = application; setJMenuBar(((SshVNCPanel) panel).getJMenuBar()); // We dont want the status bar, menu bar or tool bar showing in full screen mode by default ((SshVNCPanel) panel).setToolsVisible(false); panel.registerActionMenu(new SshToolsApplicationPanel.ActionMenu("File", "File", 'f', 0)); panel.registerAction(exitAction = new ExitAction(application, this)); panel.registerAction(newWindowAction = new NewWindowAction(application)); panel.registerAction(aboutAction = new AboutAction(this, application)); panel.registerAction(changelogAction = new ChangelogAction(this, application)); panel.registerAction(faqAction = new FAQAction()); panel.registerAction(beginnerAction = new BeginnerAction()); panel.registerAction(advancedAction = new AdvancedAction()); panel.registerAction(fullScreenAction = new FullScreenActionImpl(application, this)); getApplicationPanel().rebuildActionComponents(); JPanel p = new JPanel(new BorderLayout()); if (panel.getToolBar() != null) { JPanel t = new JPanel(new BorderLayout()); t.add(panel.getToolBar(), BorderLayout.NORTH); t.add(toolSeperator = new JSeparator(JSeparator.HORIZONTAL), BorderLayout.SOUTH); final SshToolsApplicationPanel pnl = panel; panel.getToolBar().addComponentListener(new ComponentAdapter() { public void componentHidden(ComponentEvent evt) { log.debug("Tool separator is now " + pnl.getToolBar().isVisible()); toolSeperator.setVisible(pnl.getToolBar().isVisible()); } }); p.add(t, BorderLayout.NORTH); } p.add(panel, BorderLayout.CENTER); if (panel.getStatusBar() != null) { p.add(panel.getStatusBar(), BorderLayout.SOUTH); } getContentPane().setLayout(new GridLayout(1, 1)); getContentPane().add(p); // Watch for the frame closing addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent evt) { application.closeContainer(SshVncFullScreenWindowContainer.this); } }); getContentPane().validate(); }
From source file:com.sshtools.sshterm.SshTermFullScreenWindowContainer.java
public void init(final SshToolsApplication application, SshToolsApplicationPanel panel) throws SshToolsApplicationException { // getContentPane().invalidate(); invalidate();/* w ww .j a v a2 s . c o m*/ try { Method m = getClass().getMethod("setUndecorated", new Class[] { boolean.class }); m.invoke(this, new Object[] { Boolean.TRUE }); } catch (Exception e) { e.printStackTrace(); } this.panel = panel; this.application = application; // We dont want the status bar, menu bar or tool bar showing in full screen mode by default ((SshTerminalPanel) panel).setToolsVisible(false); panel.registerActionMenu(new SshToolsApplicationPanel.ActionMenu("File", "File", 'f', 0)); panel.registerAction(exitAction = new ExitAction(application, this)); panel.registerAction(newWindowAction = new NewWindowAction(application)); panel.registerAction(aboutAction = new AboutAction(this, application)); panel.registerAction(changelogAction = new ChangelogAction(this, application)); panel.registerAction(faqAction = new FAQAction()); panel.registerAction(beginnerAction = new BeginnerAction()); panel.registerAction(advancedAction = new AdvancedAction()); panel.registerAction(fullScreenAction = new FullScreenActionImpl(application, this)); getApplicationPanel().rebuildActionComponents(); JPanel p = new JPanel(new BorderLayout()); if (panel.getToolBar() != null) { JPanel t = new JPanel(new BorderLayout()); t.add(panel.getToolBar(), BorderLayout.NORTH); t.add(toolSeperator = new JSeparator(JSeparator.HORIZONTAL), BorderLayout.SOUTH); final SshToolsApplicationPanel pnl = panel; panel.getToolBar().addComponentListener(new ComponentAdapter() { public void componentHidden(ComponentEvent evt) { log.debug("Tool separator is now " + pnl.getToolBar().isVisible()); toolSeperator.setVisible(pnl.getToolBar().isVisible()); } }); p.add(t, BorderLayout.NORTH); } p.add(panel, BorderLayout.CENTER); if (panel.getStatusBar() != null) { p.add(panel.getStatusBar(), BorderLayout.SOUTH); } JPanel x = new JPanel(new BorderLayout()); x.add(((SshTerminalPanel) panel).getJMenuBar(), BorderLayout.NORTH); x.add(p, BorderLayout.CENTER); getContentPane().setLayout(new GridLayout(1, 1)); getContentPane().add(x); // Watch for the frame closing addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent evt) { application.closeContainer(SshTermFullScreenWindowContainer.this); } }); validate(); }
From source file:de.fhg.igd.iva.explorer.main.CompareViewPanel.java
protected void updateSelection() { KnownColormap colormap = (KnownColormap) mapsCombo.getSelectedItem(); cmView.setColormap(colormap);/*ww w . j a v a2 s . co m*/ statsBars.removeAll(); Map<ColormapQuality, Double> row = table.row(colormap); Insets insets = new Insets(0, 0, 0, 0); Insets insets5 = new Insets(0, 5, 0, 0); GridBagConstraints gbcName = new GridBagConstraints(0, 0, 1, 1, 0.0, 1.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, insets, 0, 0); GridBagConstraints gbcQual = new GridBagConstraints(1, 0, 1, 1, 0.0, 1.0, GridBagConstraints.LINE_END, GridBagConstraints.NONE, insets5, 0, 0); GridBagConstraints gbcRank = new GridBagConstraints(2, 0, 1, 1, 0.0, 1.0, GridBagConstraints.LINE_END, GridBagConstraints.NONE, insets5, 0, 0); GridBagConstraints gbcStatL = new GridBagConstraints(3, 0, 1, 1, 1.0, 1.0, GridBagConstraints.LINE_START, GridBagConstraints.NONE, insets5, 0, 0); GridBagConstraints gbcStatR = new GridBagConstraints(4, 0, 1, 1, 1.0, 1.0, GridBagConstraints.LINE_END, GridBagConstraints.NONE, insets5, 0, 0); GridBagConstraints gbcStat = new GridBagConstraints(3, 0, 2, 1, 1.0, 1.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, insets5, 0, 0); statsBars.add(new JLabel("Name"), gbcName); statsBars.add(new JLabel("Score"), gbcQual); statsBars.add(new JLabel("Rank"), gbcRank); // maybe use a best/worst arrow down marker instead? unicode: \u2193 statsBars.add(new JLabel("\u2190Worse"), gbcStatL); statsBars.add(new JLabel("Better\u2192"), gbcStatR); GridBagConstraints gbcSpace = new GridBagConstraints(0, 1, 5, 1, 1.0, 1.0, GridBagConstraints.LINE_START, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 0), 0, 0); JSeparator spacing = new JSeparator(SwingConstants.HORIZONTAL); statsBars.add(spacing, gbcSpace); int count = table.rowKeySet().size(); int rowIdx = 2; for (ColormapQuality metric : row.keySet()) { double quality = row.get(metric); DescriptiveStatistics stats = computeStats(metric); int index = Arrays.binarySearch(stats.getSortedValues(), quality); int rank = metric.moreIsBetter() ? count - index : index + 1; gbcName = (GridBagConstraints) gbcName.clone(); gbcQual = (GridBagConstraints) gbcQual.clone(); gbcRank = (GridBagConstraints) gbcRank.clone(); gbcStat = (GridBagConstraints) gbcStat.clone(); gbcName.gridy = rowIdx; gbcQual.gridy = rowIdx; gbcRank.gridy = rowIdx; gbcStat.gridy = rowIdx; statsBars.add(new JLabel(metric.getName()), gbcName); statsBars.add(new JLabel(String.format("%.2f", quality)), gbcQual); statsBars.add(new JLabel(Integer.toString(rank)), gbcRank); statsBars.add(new JStatBar(metric, stats, quality), gbcStat); rowIdx++; } // I find it strange that both revalidate and repaint must be explicitly called here revalidate(); repaint(); }
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 v a 2s . c o m } 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:TextInputDemo.java
protected JComponent createAddressDisplay() { JPanel panel = new JPanel(new BorderLayout()); addressDisplay = new JLabel(); addressDisplay.setHorizontalAlignment(JLabel.CENTER); regularFont = addressDisplay.getFont().deriveFont(Font.PLAIN, 16.0f); italicFont = regularFont.deriveFont(Font.ITALIC); updateDisplays();//from ww w .j a v a2 s. co m //Lay out the panel. panel.setBorder(BorderFactory.createEmptyBorder(GAP / 2, //top 0, //left GAP / 2, //bottom 0)); //right panel.add(new JSeparator(JSeparator.VERTICAL), BorderLayout.LINE_START); panel.add(addressDisplay, BorderLayout.CENTER); panel.setPreferredSize(new Dimension(200, 150)); return panel; }
From source file:de.dakror.virtualhub.client.dialog.ChooseCatalogDialog.java
public static void show(ClientFrame frame, final JSONArray data) { final JDialog dialog = new JDialog(frame, "Katalog whlen", true); dialog.setSize(400, 300);//from w ww. j a va2 s. com dialog.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); dialog.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { Client.currentClient.disconnect(); System.exit(0); } }); JPanel contentPane = new JPanel(new FlowLayout(FlowLayout.LEADING, 0, 0)); dialog.setContentPane(contentPane); DefaultListModel dlm = new DefaultListModel(); for (int i = 0; i < data.length(); i++) { try { dlm.addElement(data.getJSONObject(i).getString("name")); } catch (JSONException e) { e.printStackTrace(); } } final JList catalogs = new JList(dlm); catalogs.setDragEnabled(false); catalogs.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); JScrollPane jsp = new JScrollPane(catalogs, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); jsp.setPreferredSize(new Dimension(396, 200)); contentPane.add(jsp); JPanel mods = new JPanel(new GridLayout(1, 2)); mods.setPreferredSize(new Dimension(50, 22)); mods.add(new JButton(new AbstractAction("+") { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { String name = JOptionPane.showInputDialog(dialog, "Bitte geben Sie den Namen des neuen Katalogs ein.", "Katalog hinzufgen", JOptionPane.PLAIN_MESSAGE); if (name != null && name.length() > 0) { DefaultListModel dlm = (DefaultListModel) catalogs.getModel(); for (int i = 0; i < dlm.getSize(); i++) { if (dlm.get(i).toString().equals(name)) { JOptionPane.showMessageDialog(dialog, "Es existert bereits ein Katalog mit diesem Namen!", "Katalog bereits vorhanden!", JOptionPane.ERROR_MESSAGE); actionPerformed(e); return; } } try { dlm.addElement(name); JSONObject o = new JSONObject(); o.put("name", name); o.put("sources", new JSONArray()); o.put("tags", new JSONArray()); data.put(o); Client.currentClient.sendPacket(new Packet0Catalogs(data)); } catch (Exception e1) { e1.printStackTrace(); } } } })); mods.add(new JButton(new AbstractAction("-") { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { if (catalogs.getSelectedIndex() != -1) { if (JOptionPane.showConfirmDialog(dialog, "Sind Sie sicher, dass Sie diesen\r\nKatalog unwiderruflich lschen wollen?", "Katalog lschen", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) { DefaultListModel dlm = (DefaultListModel) catalogs.getModel(); data.remove(catalogs.getSelectedIndex()); dlm.remove(catalogs.getSelectedIndex()); try { Client.currentClient.sendPacket(new Packet0Catalogs(data)); } catch (IOException e1) { e1.printStackTrace(); } } } } })); contentPane.add(mods); JLabel l = new JLabel(""); l.setPreferredSize(new Dimension(396, 14)); contentPane.add(l); JSeparator sep = new JSeparator(JSeparator.HORIZONTAL); sep.setPreferredSize(new Dimension(396, 10)); contentPane.add(sep); JPanel buttons = new JPanel(new GridLayout(1, 2)); buttons.setPreferredSize(new Dimension(396, 22)); buttons.add(new JButton(new AbstractAction("Abbrechen") { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { Client.currentClient.disconnect(); System.exit(0); } })); buttons.add(new JButton(new AbstractAction("Katalog whlen") { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { if (catalogs.getSelectedIndex() != -1) { try { Client.currentClient .setCatalog(new Catalog(data.getJSONObject(catalogs.getSelectedIndex()))); Client.currentClient.frame.setTitle("- " + Client.currentClient.getCatalog().getName()); dialog.dispose(); } catch (JSONException e1) { e1.printStackTrace(); } } } })); dialog.add(buttons); dialog.setLocationRelativeTo(frame); dialog.setResizable(false); dialog.setVisible(true); }
From source file:com.diversityarrays.kdxplore.field.PlotIdTrialLayoutPane.java
public PlotIdTrialLayoutPane() { super(new BorderLayout()); /*/*from ww w. ja v a 2 s . c o m*/ * * .---> <---. * | (o) (o) | * v v * (o) (o) * * * (o) (o) * ^ ^ * | (o) (o) | * `---> <---' * * Traversal: (o) 1-w (o) 2-w * * (above is in odtPanel) * --------------------------- * * Run Length: [ ] * Origin Plot Id: [ ] */ JPanel top = new JPanel(); GBH gbh = new GBH(top); int y = 0; gbh.add(0, y, 1, 1, GBH.NONE, 1, 1, GBH.EAST, "Plot Ids:"); gbh.add(1, y, 3, 1, GBH.HORZ, 1, 1, GBH.WEST, plotIdentInfo); ++y; // - - - - - - - JPanel bottom = new JPanel(); GBH rgbh = new GBH(bottom); y = 0; rgbh.add(0, y, 1, 1, GBH.NONE, 1, 1, GBH.EAST, "Run Length:"); rgbh.add(1, y, 1, 1, GBH.HORZ, 1, 1, GBH.CENTER, runLengthSpinner); ++y; rgbh.add(0, y, 1, 1, GBH.NONE, 1, 1, GBH.EAST, "Origin Plot Id:"); rgbh.add(1, y, 1, 1, GBH.HORZ, 1, 1, GBH.CENTER, plotSpinner); ++y; // - - - - - - - Box main = Box.createVerticalBox(); main.add(top); main.add(withInsets(new JSeparator(JSeparator.HORIZONTAL), new Insets(0, 20, 0, 20))); main.add(odtPanel); main.add(withInsets(new JSeparator(JSeparator.HORIZONTAL), new Insets(0, 20, 0, 20))); main.add(bottom); add(main, BorderLayout.CENTER); // crb_ll_right.doClick(); ChangeListener changeListener = new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { if (initialised) { firePropertyChange(PROP_LAYOUT_CHANGED, false, true); } } }; runLengthModel.addChangeListener(changeListener); plotIdModel.addChangeListener(changeListener); initialised = true; }