List of usage examples for javax.swing JSeparator JSeparator
public JSeparator(int orientation)
From source file:com.sshtools.common.ui.SshToolsApplicationInternalFrame.java
/** * * * @param application/*from w w w . j a v a 2 s . com*/ * @param panel * * @throws SshToolsApplicationException */ public void init(final SshToolsApplication application, SshToolsApplicationPanel panel) throws SshToolsApplicationException { this.panel = panel; this.application = application; if (application != null) { setTitle(ConfigurationLoader.getVersionString(application.getApplicationName(), application.getApplicationVersion())); // + " " + application.getApplicationVersion()); } // Register the File menu panel.registerActionMenu(new SshToolsApplicationPanel.ActionMenu("File", "File", 'f', 0)); // Register the Exit action if (showExitAction && application != null) { panel.registerAction(exitAction = new ExitAction(application, this)); // Register the New Window Action } if (showNewWindowAction && application != null) { panel.registerAction(newWindowAction = new NewWindowAction(application)); // Register the Help menu } panel.registerActionMenu(new SshToolsApplicationPanel.ActionMenu("Help", "Help", 'h', 99)); // Register the About box action if (showAboutBox && application != null) { panel.registerAction(aboutAction = new AboutAction(this, application)); } // Register the Changelog box action if (showChangelogBox && application != null) { panel.registerAction(changelogAction = new ChangelogAction(this, application)); } panel.registerAction(faqAction = new FAQAction()); panel.registerAction(beginnerAction = new BeginnerAction()); panel.registerAction(advancedAction = new AdvancedAction()); getApplicationPanel().rebuildActionComponents(); JPanel p = new JPanel(new BorderLayout()); if (panel.getJMenuBar() != null) { setJMenuBar(panel.getJMenuBar()); } if (panel.getToolBar() != null) { JPanel t = new JPanel(new BorderLayout()); t.add(panel.getToolBar(), BorderLayout.NORTH); t.add(toolSeparator = new JSeparator(JSeparator.HORIZONTAL), BorderLayout.SOUTH); toolSeparator.setVisible(panel.getToolBar().isVisible()); final SshToolsApplicationPanel pnl = panel; panel.getToolBar().addComponentListener(new ComponentAdapter() { public void componentHidden(ComponentEvent evt) { log.debug("Tool separator is now " + pnl.getToolBar().isVisible()); toolSeparator.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 //setDefaultCloseOperation(JInternalFrame.DO_NOTHING_ON_CLOSE); addVetoableChangeListener(new VetoableChangeListener() { public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException { if (application != null) { application.closeContainer(SshToolsApplicationInternalFrame.this); } else { if (evt.getPropertyName().equals(IS_CLOSED_PROPERTY)) { boolean changed = ((Boolean) evt.getNewValue()).booleanValue(); if (changed) { int confirm = JOptionPane.showOptionDialog(SshToolsApplicationInternalFrame.this, "Close " + getTitle() + "?", "Close Operation", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null); if (confirm == 0) { SshToolsApplicationInternalFrame.this.getDesktopPane() .remove(SshToolsApplicationInternalFrame.this); } } } } } }); /*this.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent evt) { if(application!=null) application.closeContainer(SshToolsApplicationFrame.this); else hide(); } }); // If this is the first frame, center the window on the screen /*Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); boolean found = false; if (application!=null && application.getContainerCount() != 0) { for (int i = 0; (i < application.getContainerCount()) && !found; i++) { SshToolsApplicationContainer c = application.getContainerAt(i); if (c instanceof SshToolsApplicationFrame) { SshToolsApplicationFrame f = (SshToolsApplicationFrame) c; setSize(f.getSize()); Point newLocation = new Point(f.getX(), f.getY()); newLocation.x += 48; newLocation.y += 48; if (newLocation.x > (screenSize.getWidth() - 64)) { newLocation.x = 0; } if (newLocation.y > (screenSize.getHeight() - 64)) { newLocation.y = 0; } setLocation(newLocation); found = true; } } } if (!found) { // Is there a previous stored geometry we can use? if (PreferencesStore.preferenceExists(PREF_LAST_FRAME_GEOMETRY)) { setBounds(PreferencesStore.getRectangle( PREF_LAST_FRAME_GEOMETRY, getBounds())); } else { pack(); UIUtil.positionComponent(SwingConstants.CENTER, this); } }*/ pack(); }
From source file:com.sshtools.common.ui.SshToolsApplicationFrame.java
/** * * * @param application/*from w w w .j av a 2s .c o m*/ * @param panel * * @throws SshToolsApplicationException */ public void init(final SshToolsApplication application, SshToolsApplicationPanel panel) throws SshToolsApplicationException { this.panel = panel; this.application = application; if (application != null) { setTitle(ConfigurationLoader.getVersionString(application.getApplicationName(), application.getApplicationVersion())); // + " " + application.getApplicationVersion()); } setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); // Register the File menu panel.registerActionMenu(new SshToolsApplicationPanel.ActionMenu("File", "File", 'f', 0)); // Register the Exit action if (showExitAction && application != null) { panel.registerAction(exitAction = new ExitAction(application, this)); // Register the New Window Action } if (showNewWindowAction && application != null) { panel.registerAction(newWindowAction = new NewWindowAction(application)); // Register the Help menu } panel.registerActionMenu(new SshToolsApplicationPanel.ActionMenu("Help", "Help", 'h', 99)); // Register the About box action if (showAboutBox && application != null) { panel.registerAction(aboutAction = new AboutAction(this, application)); } // Register the Changelog box action if (showChangelogBox && application != null) { panel.registerAction(changelogAction = new ChangelogAction(this, application)); } panel.registerAction(faqAction = new FAQAction()); panel.registerAction(beginnerAction = new BeginnerAction()); panel.registerAction(advancedAction = new AdvancedAction()); getApplicationPanel().rebuildActionComponents(); JPanel p = new JPanel(new BorderLayout()); if (panel.getJMenuBar() != null) { setJMenuBar(panel.getJMenuBar()); } if (panel.getToolBar() != null) { JPanel t = new JPanel(new BorderLayout()); t.add(panel.getToolBar(), BorderLayout.NORTH); t.add(toolSeparator = new JSeparator(JSeparator.HORIZONTAL), BorderLayout.SOUTH); toolSeparator.setVisible(panel.getToolBar().isVisible()); final SshToolsApplicationPanel pnl = panel; panel.getToolBar().addComponentListener(new ComponentAdapter() { public void componentHidden(ComponentEvent evt) { log.debug("Tool separator is now " + pnl.getToolBar().isVisible()); toolSeparator.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 setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent evt) { if (application != null) { application.closeContainer(SshToolsApplicationFrame.this); } else { int confirm = JOptionPane.showOptionDialog(SshToolsApplicationFrame.this, "Close " + getTitle() + "?", "Close Operation", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null); if (confirm == 0) { hide(); } } } }); // If this is the first frame, center the window on the screen Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); boolean found = false; if (application != null && application.getContainerCount() != 0) { for (int i = 0; (i < application.getContainerCount()) && !found; i++) { SshToolsApplicationContainer c = application.getContainerAt(i); if (c instanceof SshToolsApplicationFrame) { SshToolsApplicationFrame f = (SshToolsApplicationFrame) c; setSize(f.getSize()); Point newLocation = new Point(f.getX(), f.getY()); newLocation.x += 48; newLocation.y += 48; if (newLocation.x > (screenSize.getWidth() - 64)) { newLocation.x = 0; } if (newLocation.y > (screenSize.getHeight() - 64)) { newLocation.y = 0; } setLocation(newLocation); found = true; } } } if (!found) { // Is there a previous stored geometry we can use? if (PreferencesStore.preferenceExists(PREF_LAST_FRAME_GEOMETRY)) { setBounds(PreferencesStore.getRectangle(PREF_LAST_FRAME_GEOMETRY, getBounds())); } else { pack(); UIUtil.positionComponent(SwingConstants.CENTER, this); } } }
From source file:net.sf.jabref.gui.preftabs.PreviewPrefsTab.java
public PreviewPrefsTab(JabRefPreferences prefs) { this.prefs = prefs; GridBagLayout layout = new GridBagLayout(); firstPanel.setLayout(layout);//from ww w . java 2 s .c o m secondPanel.setLayout(layout); setLayout(layout); JLabel lab = new JLabel(Localization.lang("Preview") + " 1"); GridBagConstraints layoutConstraints = new GridBagConstraints(); layoutConstraints.anchor = GridBagConstraints.WEST; layoutConstraints.gridwidth = GridBagConstraints.REMAINDER; layoutConstraints.fill = GridBagConstraints.BOTH; layoutConstraints.weightx = 1; layoutConstraints.weighty = 0; layoutConstraints.insets = new Insets(2, 2, 2, 2); layout.setConstraints(lab, layoutConstraints); layoutConstraints.weighty = 1; layout.setConstraints(firstScrollPane, layoutConstraints); firstPanel.add(firstScrollPane); layoutConstraints.weighty = 0; layoutConstraints.gridwidth = 1; layoutConstraints.weightx = 0; layoutConstraints.fill = GridBagConstraints.NONE; layoutConstraints.anchor = GridBagConstraints.WEST; layout.setConstraints(testButton, layoutConstraints); firstPanel.add(testButton); layout.setConstraints(defaultButton, layoutConstraints); firstPanel.add(defaultButton); layoutConstraints.gridwidth = GridBagConstraints.REMAINDER; JPanel newPan = new JPanel(); layoutConstraints.weightx = 1; layout.setConstraints(newPan, layoutConstraints); firstPanel.add(newPan); lab = new JLabel(Localization.lang("Preview") + " 2"); layout.setConstraints(lab, layoutConstraints); // p2.add(lab); layoutConstraints.weighty = 1; layoutConstraints.fill = GridBagConstraints.BOTH; layout.setConstraints(secondScrollPane, layoutConstraints); secondPanel.add(secondScrollPane); layoutConstraints.weighty = 0; layoutConstraints.weightx = 0; layoutConstraints.fill = GridBagConstraints.NONE; layoutConstraints.gridwidth = 1; layout.setConstraints(testButton2, layoutConstraints); secondPanel.add(testButton2); layout.setConstraints(defaultButton2, layoutConstraints); secondPanel.add(defaultButton2); layoutConstraints.gridwidth = 1; newPan = new JPanel(); layoutConstraints.weightx = 1; layout.setConstraints(newPan, layoutConstraints); secondPanel.add(newPan); layoutConstraints.weightx = 1; layoutConstraints.weighty = 0; layoutConstraints.fill = GridBagConstraints.BOTH; layoutConstraints.gridwidth = GridBagConstraints.REMAINDER; lab = new JLabel(Localization.lang("Preview") + " 1"); layout.setConstraints(lab, layoutConstraints); add(lab); layoutConstraints.weighty = 1; layout.setConstraints(firstPanel, layoutConstraints); add(firstPanel); lab = new JLabel(Localization.lang("Preview") + " 2"); layoutConstraints.weighty = 0; JSeparator sep = new JSeparator(SwingConstants.HORIZONTAL); layout.setConstraints(sep, layoutConstraints); add(sep); layout.setConstraints(lab, layoutConstraints); add(lab); layoutConstraints.weighty = 1; layout.setConstraints(secondPanel, layoutConstraints); add(secondPanel); layoutConstraints.weighty = 0; defaultButton.addActionListener(e -> { String tmp = layout1.getText().replace("\n", "__NEWLINE__"); PreviewPrefsTab.this.prefs.remove(JabRefPreferences.PREVIEW_0); layout1.setText( PreviewPrefsTab.this.prefs.get(JabRefPreferences.PREVIEW_0).replace("__NEWLINE__", "\n")); PreviewPrefsTab.this.prefs.put(JabRefPreferences.PREVIEW_0, tmp); }); defaultButton2.addActionListener(e -> { String tmp = layout2.getText().replace("\n", "__NEWLINE__"); PreviewPrefsTab.this.prefs.remove(JabRefPreferences.PREVIEW_1); layout2.setText( PreviewPrefsTab.this.prefs.get(JabRefPreferences.PREVIEW_1).replace("__NEWLINE__", "\n")); PreviewPrefsTab.this.prefs.put(JabRefPreferences.PREVIEW_1, tmp); }); testButton.addActionListener(e -> { PreviewPrefsTab.getTestEntry(); try { PreviewPanel testPanel = new PreviewPanel(null, PreviewPrefsTab.entry, null, layout1.getText()); testPanel.setPreferredSize(new Dimension(800, 350)); JOptionPane.showMessageDialog(null, testPanel, Localization.lang("Preview"), JOptionPane.PLAIN_MESSAGE); } catch (StringIndexOutOfBoundsException ex) { LOGGER.warn("Parsing error.", ex); JOptionPane.showMessageDialog(null, Localization.lang("Parsing error") + ": " + Localization.lang("illegal backslash expression") + ".\n" + ex.getMessage(), Localization.lang("Parsing error"), JOptionPane.ERROR_MESSAGE); } }); testButton2.addActionListener(e -> { PreviewPrefsTab.getTestEntry(); try { PreviewPanel testPanel = new PreviewPanel(null, PreviewPrefsTab.entry, null, layout2.getText()); testPanel.setPreferredSize(new Dimension(800, 350)); JOptionPane.showMessageDialog(null, new JScrollPane(testPanel), Localization.lang("Preview"), JOptionPane.PLAIN_MESSAGE); } catch (StringIndexOutOfBoundsException ex) { LOGGER.warn("Parsing error.", ex); JOptionPane.showMessageDialog(null, Localization.lang("Parsing error") + ": " + Localization.lang("illegal backslash expression") + ".\n" + ex.getMessage(), Localization.lang("Parsing error"), JOptionPane.ERROR_MESSAGE); } }); }
From source file:llc.rockford.webcast.EC2Driver.java
public Component createComponents() { startButton = new JButton("START SERVER"); startButton.setEnabled(false);//from w ww.ja va 2s .c o m startButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { startButton.setEnabled(false); stopButton.setEnabled(false); new StartInstanceWorker(ec2Handle.getEc2Handle(), applicationState, amazonProperties).execute(); } }); startStreamButton = new JButton("START BROADCAST"); startStreamButton.setEnabled(false); startStreamButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { startStreamButton.setEnabled(false); stopStreamButton.setEnabled(true); try { broadcaster.start(); } catch (ExecuteException e1) { startStreamButton.setEnabled(true); e1.printStackTrace(); } catch (IOException e1) { startStreamButton.setEnabled(true); e1.printStackTrace(); } catch (InterruptedException e1) { e1.printStackTrace(); } } }); stopStreamButton = new JButton("STOP BROADCAST"); stopStreamButton.setEnabled(false); stopStreamButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { broadcaster.stop(); } }); statusLabel.setHorizontalAlignment(SwingConstants.CENTER); statusLabel.setOpaque(true); statusLabel.setBackground(Color.YELLOW); broadcastStatusLabel.setHorizontalAlignment(SwingConstants.CENTER); broadcastStatusLabel.setOpaque(true); broadcastStatusLabel.setBackground(Color.RED); stopButton = new JButton("STOP SERVER"); stopButton.setEnabled(false); stopButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { startButton.setEnabled(false); stopButton.setEnabled(false); new TerminateInstanceWorker(ec2Handle.getEc2Handle(), applicationState, amazonProperties).execute(); } }); JPanel pane = new JPanel(new GridLayout(7, 1)); pane.add(startButton); pane.add(statusLabel); pane.add(stopButton); pane.add(new JSeparator(SwingConstants.HORIZONTAL)); pane.add(startStreamButton); pane.add(broadcastStatusLabel); pane.add(stopStreamButton); pane.setBorder(BorderFactory.createEmptyBorder(30, // top 30, // left 10, // bottom 30) // right ); return pane; }
From source file:de.tud.kom.p2psim.impl.skynet.visualization.SkyNetVisualization.java
public void setAvailableMetrics(Vector<String> names) { Vector<String> temp = new Vector<String>(); temp.addAll(names);//from w w w . j a v a 2 s . c o m temp.add("Online Peers"); temp.add("Available Attributes"); temp.add("Memory Usage"); Collections.sort(temp); JMenu met = mb.getMenu(1); met.setEnabled(true); JMenu avgMet = new JMenu("Average Metrics"); JMenu genMet = new JMenu("General Metrics"); JMenu recMet = new JMenu("Metrics for Receiving"); JMenu sentMet = new JMenu("Metrics for Sending"); JCheckBoxMenuItem item = null; for (String name : temp) { if (name.startsWith("Aver")) { item = new JCheckBoxMenuItem(name, false); item.addActionListener(this); avgMet.add(item); } else if (name.startsWith("Rec")) { item = new JCheckBoxMenuItem(name, false); item.addActionListener(this); recMet.add(item); } else if (name.startsWith("Sent")) { item = new JCheckBoxMenuItem(name, false); item.addActionListener(this); sentMet.add(item); } else { item = new JCheckBoxMenuItem(name, false); item.addActionListener(this); genMet.add(item); } } avgMet.add(new JSeparator(SwingConstants.HORIZONTAL)); avgMet.add(createMenuItem("Display all Average Metrics")); avgMet.add(createMenuItem("Remove all Average Metrics")); genMet.add(new JSeparator(SwingConstants.HORIZONTAL)); genMet.add(createMenuItem("Display all General Metrics")); genMet.add(createMenuItem("Remove all General Metrics")); recMet.add(new JSeparator(SwingConstants.HORIZONTAL)); recMet.add(createMenuItem("Display all Metrics for Receiving")); recMet.add(createMenuItem("Remove all Metrics for Receiving")); sentMet.add(new JSeparator(SwingConstants.HORIZONTAL)); sentMet.add(createMenuItem("Display all Metrics for Sending")); sentMet.add(createMenuItem("Remove all Metrics for Sending")); met.add(avgMet); met.add(genMet); met.add(recMet); met.add(sentMet); met.add(new JSeparator(SwingConstants.HORIZONTAL)); met.add(createMenuItem("Display all Metrics")); met.add(createMenuItem("Remove all Metrics")); mb.add(met); repaint(); log.warn("Created Menu 'Available Metrics'"); }
From source file:com.willwinder.ugs.nbp.setupwizard.panels.WizardPanelStepCalibration.java
private void addHeaderRow(JPanel panel) { Font labelHeaderFont = new Font(Font.SANS_SERIF, Font.BOLD, 16); JLabel headerLabel = new JLabel(Localization.getString("platform.plugin.setupwizard.move"), JLabel.CENTER); headerLabel.setFont(labelHeaderFont); panel.add(headerLabel, "growx, spanx 3, gapbottom 5, gaptop 7"); panel.add(new JSeparator(SwingConstants.VERTICAL), "spany 5, gapleft 5, gapright 5, wmin 10, grow"); headerLabel = new JLabel(Localization.getString("platform.plugin.setupwizard.measure"), JLabel.CENTER); headerLabel.setFont(labelHeaderFont); panel.add(headerLabel, "growx, spanx 2, gapbottom 5, gaptop 7"); panel.add(new JSeparator(SwingConstants.VERTICAL), "spany 5, gapleft 5, gapright 5, wmin 10, grow"); headerLabel = new JLabel(Localization.getString("platform.plugin.setupwizard.calibrate"), JLabel.CENTER); headerLabel.setFont(labelHeaderFont); panel.add(headerLabel, "growx, spanx 3, wrap, gapbottom 5, gaptop 7"); }
From source file:it.iit.genomics.cru.igb.bundles.mi.view.MIResultPanel.java
public MIResultPanel(IgbService service, String summary, List<MIResult> results, String label, MIQuery query) { setLayout(new BorderLayout()); this.label = label; igbLogger = IGBLogger.getInstance(label); colorer = TaxonColorer.getColorer(query.getTaxid()); Box menuBox = new Box(BoxLayout.X_AXIS); Box buttonBox = new Box(BoxLayout.Y_AXIS); Box buttonBox1 = new Box(BoxLayout.X_AXIS); Box buttonBox3 = new Box(BoxLayout.X_AXIS); buttonBox.add(buttonBox1);/*from ww w . j ava2s .co m*/ buttonBox.add(buttonBox3); JTextPane querySummary = new JTextPane(); querySummary.setContentType("text/html"); querySummary.setEditable(false); querySummary.setText(summary); menuBox.add(querySummary); menuBox.add(buttonBox); final JFrame logFrame = new JFrame("MI Bundle Log"); logFrame.setVisible(false); Dimension preferredSize = new Dimension(800, 500); logFrame.setPreferredSize(preferredSize); logFrame.setMinimumSize(preferredSize); logFrame.add(new LogPanel(igbLogger)); JButton log = new JButton(); if (igbLogger.hasError()) { log.setBackground(Color.red); } log.setIcon(CommonUtils.getInstance().getIcon("16x16/actions/console.png")); log.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { logFrame.setVisible(true); } }); buttonBox1.add(log); JButton networkButton = new JButton(""); networkButton.setIcon(new ImageIcon(getClass().getResource("/network.jpg"))); networkButton.addActionListener(new DisplayNetworkActionListener()); buttonBox1.add(networkButton); buttonBox1.add(new JSeparator(JSeparator.VERTICAL)); buttonBox1.add(new JLabel("Save: ")); JButton exportButton = new JButton("text"); exportButton.setIcon(CommonUtils.getInstance().getIcon("16x16/actions/save.png")); exportButton.addActionListener(new ExportActionListener()); if (false == MICommons.testVersion) { buttonBox1.add(exportButton); } JButton exportXgmmlButton = new JButton("xgmml"); exportXgmmlButton.setIcon(CommonUtils.getInstance().getIcon("16x16/actions/save.png")); exportXgmmlButton.addActionListener(new ExportXgmmlActionListener()); if (false == MICommons.testVersion) { buttonBox1.add(exportXgmmlButton); } buttonBox1.add(new JSeparator(JSeparator.VERTICAL)); buttonBox1.add(new JLabel("View structure: ")); structures = new StructuresPanel(service, label); buttonBox1.add(structures.getJmolButton()); buttonBox1.add(structures.getLinkButton()); // Filters ButtonGroup scoreGroup = new ButtonGroup(); JRadioButton scoreButton0 = new JRadioButton("<html>" + HTML_SCORE_0 + "</html>"); JRadioButton scoreButton1 = new JRadioButton("<html>" + HTML_SCORE_1 + "</html>"); JRadioButton scoreButton2 = new JRadioButton("<html>" + HTML_SCORE_2 + "</html>"); JRadioButton scoreButton3 = new JRadioButton("<html>" + HTML_SCORE_3 + "</html>"); scoreButton0.setSelected(true); ScoreListener scoreListener = new ScoreListener(); scoreButton0.addActionListener(scoreListener); scoreButton1.addActionListener(scoreListener); scoreButton2.addActionListener(scoreListener); scoreButton3.addActionListener(scoreListener); scoreGroup.add(scoreButton0); scoreGroup.add(scoreButton1); scoreGroup.add(scoreButton2); scoreGroup.add(scoreButton3); buttonBox1.add(new JSeparator(JSeparator.VERTICAL)); buttonBox1.add(new JLabel("Score: ")); buttonBox1.add(scoreButton0); buttonBox1.add(scoreButton1); buttonBox1.add(scoreButton2); buttonBox1.add(scoreButton3); buttonBox3.add(new JLabel("Interaction type: ")); JCheckBox EvidencePhysicalButton = new JCheckBox(HTML_CHECKBOX_PHYSICAL); JCheckBox EvidenceAssociationButton = new JCheckBox(HTML_CHECKBOX_ASSOCIATION); JCheckBox EvidenceEnzymaticButton = new JCheckBox(HTML_CHECKBOX_ENZYMATIC); JCheckBox EvidenceOtherButton = new JCheckBox(HTML_CHECKBOX_OTHER); JCheckBox EvidenceUnspecifiedButton = new JCheckBox(HTML_CHECKBOX_UNSPECIFIED); JCheckBox EvidenceStructureButton = new JCheckBox(HTML_CHECKBOX_STRUCTURE); EvidencePhysicalButton.setSelected(true); EvidenceAssociationButton.setSelected(true); EvidenceEnzymaticButton.setSelected(true); EvidenceOtherButton.setSelected(true); EvidenceUnspecifiedButton.setSelected(true); EvidenceStructureButton.setSelected(true); buttonBox3.add(EvidencePhysicalButton); buttonBox3.add(EvidenceAssociationButton); buttonBox3.add(EvidenceEnzymaticButton); buttonBox3.add(EvidenceOtherButton); buttonBox3.add(EvidenceUnspecifiedButton); buttonBox3.add(EvidenceStructureButton); EvidenceTypeListener evidenceListener = new EvidenceTypeListener(); EvidencePhysicalButton.addActionListener(evidenceListener); EvidenceAssociationButton.addActionListener(evidenceListener); EvidenceEnzymaticButton.addActionListener(evidenceListener); EvidenceOtherButton.addActionListener(evidenceListener); EvidenceUnspecifiedButton.addActionListener(evidenceListener); EvidenceStructureButton.addActionListener(evidenceListener); Box tableBox = new Box(BoxLayout.Y_AXIS); MITableModel model = new MITableModel(results); miTable = new MITable(model, service, query); miTable.setFillsViewportHeight(true); miTable.setStructuresPanel(structures); tableBox.add(miTable.getTableHeader()); tableBox.add(miTable); JScrollPane tableScroll = new JScrollPane(tableBox); tableScroll.setMinimumSize(new Dimension(800, 50)); tableScroll.setPreferredSize(new Dimension(800, 50)); tableScroll.setMaximumSize(new Dimension(Short.MAX_VALUE, Short.MAX_VALUE)); structures.setMinimumSize(new Dimension(200, 500)); structures.setPreferredSize(new Dimension(200, 500)); structures.setMaximumSize(new Dimension(200, Short.MAX_VALUE)); resultBox = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, tableScroll, structures); resultBox.setOneTouchExpandable(true); add(menuBox, BorderLayout.NORTH); add(resultBox, BorderLayout.CENTER); }
From source file:com.sshtools.common.ui.SshToolsApplicationApplet.java
/** * * * @return// w ww . j a v a2s . c o m * * @throws IOException * @throws SshToolsApplicationException */ public JComponent buildAppletComponent() throws IOException, SshToolsApplicationException { loadingPanel.setStatus("Creating application"); applicationPanel = createApplicationPanel(); loadingPanel.setStatus("Building action components"); applicationPanel.rebuildActionComponents(); log.debug("Disabled actions list = " + disabledActions); StringTokenizer tk = new StringTokenizer((disabledActions == null) ? "" : disabledActions, ","); while (tk.hasMoreTokens()) { String n = tk.nextToken(); log.debug("Disable " + n); applicationPanel.setActionVisible(n, false); } JPanel p = new JPanel(new BorderLayout()); JPanel n = new JPanel(new BorderLayout()); if (applicationPanel.getJMenuBar() != null) { n.add(applicationPanel.getJMenuBar(), BorderLayout.NORTH); log.debug("Setting menu bar visibility to " + menuBar); applicationPanel.setMenuBarVisible(menuBar); } if (applicationPanel.getToolBar() != null) { JPanel t = new JPanel(new BorderLayout()); t.add(applicationPanel.getToolBar(), BorderLayout.NORTH); applicationPanel.setToolBarVisible(toolBar); t.add(toolSeparator = new JSeparator(JSeparator.HORIZONTAL), BorderLayout.SOUTH); toolSeparator.setVisible(applicationPanel.getToolBar().isVisible()); final SshToolsApplicationPanel pnl = applicationPanel; applicationPanel.getToolBar().addComponentListener(new ComponentAdapter() { public void componentHidden(ComponentEvent evt) { toolSeparator.setVisible(pnl.getToolBar().isVisible()); } }); n.add(t, BorderLayout.SOUTH); } p.add(n, BorderLayout.NORTH); p.add(applicationPanel, BorderLayout.CENTER); if (applicationPanel.getStatusBar() != null) { p.add(applicationPanel.getStatusBar(), BorderLayout.SOUTH); applicationPanel.setStatusBarVisible(statusBar); } return p; }
From source file:net.daboross.outputtablesclient.gui.OutputInterface.java
@Override public void onUpdate(final RobotTable table, final String key, final String value, final UpdateAction action) { if (!application.getOutput().getNameTable().contains(table.getName())) { return;// w ww . j ava 2 s . c om } if (action == UpdateAction.NEW) { // if (key.equalsIgnoreCase(":RangeGUI")) { // Output.oLog("Range: %s", value); // try { // application.getCustomInterface().setTo(Double.parseDouble(value)); // } catch (NumberFormatException ex) { // Output.oLog("Invalid range '%s'", value); // } // } ensureTableExists(table.getName()); JPanel panel = new JPanel(new GridBagLayout()); panel.setBorder(new LineBorder(Color.BLACK)); tableKeyAndKeyToValuePanel.get(table.getName()).put(key, panel); JLabel keyLabel = new JLabel(key); keyLabel.setBorder(new EmptyBorder(5, 5, 5, 5)); panel.add(keyLabel, new GBC().fill(GridBagConstraints.VERTICAL).gridy(0)); JSeparator separator = new JSeparator(JSeparator.VERTICAL); separator.setPreferredSize(new Dimension(2, 20)); panel.add(separator, new GBC().fill(GridBagConstraints.VERTICAL).gridy(0)); JLabel valueLabel = new JLabel(value); valueLabel.setBorder(new EmptyBorder(5, 5, 5, 5)); panel.add(valueLabel, new GBC().fill(GridBagConstraints.VERTICAL).gridy(0)); tableKeyAndKeyToValueLabel.get(table.getName()).put(key, valueLabel); JPanel parentPanel = tableKeyToTablePanel.get(table.getName()); parentPanel.add(panel); parentPanel.revalidate(); } else if (action == UpdateAction.UPDATE) { // if (key.equalsIgnoreCase(":RangeGUI")) { // Output.oLog("Range: %s", value); // try { // application.getCustomInterface().setTo(Double.parseDouble(value)); // } catch (NumberFormatException ex) { // Output.oLog("Invalid range '%s'", value); // } // } ensureTableExists(table.getName()); JLabel valueLabel = tableKeyAndKeyToValueLabel.get(table.getName()).get(key); valueLabel.setText(value); } else if (action == UpdateAction.DELETE) { if (tableKeyToTablePanel.get(table.getName()) == null) { return; } JPanel parentPanel = tableKeyToTablePanel.get(table.getName()); JPanel valuePanel = tableKeyAndKeyToValuePanel.get(table.getName()).remove(key); parentPanel.remove(valuePanel); parentPanel.revalidate(); } }
From source file:com.codeasylum.liquibase.Liquidate.java
public Liquidate() { super("Liquidate"); ParaboxLayoutManager layout;/* w w w . java 2s . c om*/ ParallelBox goalHorizontalBox; SerialBox sourceHorizontalBox; ParallelBox sourceVerticalBox; SerialBox goalVerticalBox; JSeparator buttonSeparator; JRadioButton[] sourceButtons; JRadioButton[] goalButtons; JLabel databaseLabel; JLabel hostLabel; JLabel colonLabel; JLabel schemaLabel; JLabel userLabel; JLabel passwordLabel; JLabel sourceLabel; JLabel goalLabel; JLabel outputLabel; int sourceIndex = 0; int goalIndex = 0; config = new LiquidateConfig(); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setLayout(layout = new ParaboxLayoutManager(getContentPane())); databaseLabel = new JLabel("Database:"); databaseCombo = new JComboBox(Database.values()); databaseCombo.addItemListener(this); hostLabel = new JLabel("Host and Port:"); hostTextField = new JTextField(); hostTextField.getDocument().addDocumentListener(this); portTextField = new JTextField(); portTextField.setHorizontalAlignment(JTextField.RIGHT); portTextField.setPreferredSize(new Dimension(50, (int) portTextField.getPreferredSize().getHeight())); portTextField.setMaximumSize(portTextField.getPreferredSize()); portTextField.getDocument().addDocumentListener(this); colonLabel = new JLabel(":"); schemaLabel = new JLabel("Schema:"); schemaTextField = new JTextField(); schemaTextField.getDocument().addDocumentListener(this); userLabel = new JLabel("User:"); userTextField = new JTextField(); userTextField.getDocument().addDocumentListener(this); passwordLabel = new JLabel("Password:"); passwordField = new JPasswordField(); passwordField.getDocument().addDocumentListener(this); sourceLabel = new JLabel("Change Log:"); sourceButtonGroup = new EventCoalescingButtonGroup(); sourceButtons = new JRadioButton[Source.values().length]; for (Source source : Source.values()) { sourceButtonGroup.add(sourceButtons[sourceIndex] = new JRadioButton( StringUtilities.toDisplayCase(source.name(), '_'))); sourceButtons[sourceIndex++].setActionCommand(source.name()); } sourceButtons[0].setSelected(true); sourceButtonGroup.addActionListener(this); changeLogTextField = new JTextField(); changeLogTextField.getDocument().addDocumentListener(this); goalLabel = new JLabel("Goal:"); goalButtonGroup = new EventCoalescingButtonGroup(); goalButtons = new JRadioButton[Goal.values().length - 1]; for (Goal goal : Goal.values()) { if (!goal.equals(Goal.NONE)) { goalButtonGroup.add( goalButtons[goalIndex] = new JRadioButton(StringUtilities.toDisplayCase(goal.name(), '_'))); goalButtons[goalIndex++].setActionCommand(goal.name()); } } goalButtons[0].setSelected(true); goalButtonGroup.addActionListener(this); outputLabel = new JLabel("Output:"); browseButton = new JButton("Browse...", BROWSE_ICON); browseButton.setMargin(new Insets(2, 2, 2, 2)); browseButton.setFocusable(false); browseButton.setToolTipText("browse for a file"); browseButton.addActionListener(this); browseButton.setEnabled(false); outputTextField = new JTextField(); outputTextField.getDocument().addDocumentListener(this); outputTextField.setEnabled(false); buttonSeparator = new JSeparator(JSeparator.HORIZONTAL); buttonSeparator.setMaximumSize( new Dimension(Integer.MAX_VALUE, (int) buttonSeparator.getPreferredSize().getHeight())); startButton = new JButton("Start"); startButton.addActionListener(this); layout.setHorizontalBox(layout.parallelBox().add(layout.sequentialBox() .add(layout.parallelBox(Alignment.TRAILING).add(databaseLabel).add(hostLabel).add(schemaLabel) .add(userLabel).add(passwordLabel).add(sourceLabel).add(goalLabel).add(outputLabel)) .add(goalHorizontalBox = layout.parallelBox().add(databaseCombo, Constraint.expand()) .add(layout.sequentialBox(3).add(hostTextField, Constraint.expand()).add(colonLabel) .add(portTextField)) .add(schemaTextField, Constraint.expand()).add(userTextField, Constraint.expand()) .add(passwordField, Constraint.expand()).add(sourceHorizontalBox = layout.sequentialBox()) .add(changeLogTextField, Constraint.expand()) .add(layout.parallelBox(Alignment.TRAILING).add(outputTextField, Constraint.expand()) .add(browseButton)))) .add(buttonSeparator, Constraint.expand()) .add(layout.sequentialBox(Justification.LAST, true).add(startButton))); for (JRadioButton sourceButton : sourceButtons) { sourceHorizontalBox.add(sourceButton); } for (JRadioButton goalButton : goalButtons) { goalHorizontalBox.add(goalButton); } layout.setVerticalBox(layout.sequentialBox() .add(layout.sequentialBox() .add(layout.parallelBox(Alignment.BASELINE).add(databaseLabel).add(databaseCombo)) .add(layout.parallelBox(Alignment.BASELINE).add(hostLabel).add(hostTextField) .add(colonLabel).add(portTextField)) .add(layout.parallelBox(Alignment.BASELINE).add(schemaLabel).add(schemaTextField)) .add(layout.parallelBox(Alignment.BASELINE).add(userLabel).add(userTextField)) .add(layout.parallelBox(Alignment.BASELINE).add(passwordLabel).add(passwordField))) .add(layout.sequentialBox(3) .add(layout.parallelBox(Alignment.CENTER).add(sourceLabel) .add(sourceVerticalBox = layout.parallelBox())) .add(changeLogTextField)) .add(goalVerticalBox = layout.sequentialBox(Gap.NONE) .add(layout.parallelBox(Alignment.BASELINE).add(goalLabel).add(goalButtons[0])))); for (JRadioButton sourceButton : sourceButtons) { sourceVerticalBox.add(sourceButton); } for (int count = 1; count < goalButtons.length; count++) { goalVerticalBox.add(goalButtons[count]); } layout.getVerticalBox() .add(layout.sequentialBox(Gap.RELATED) .add(layout.parallelBox(Alignment.BASELINE).add(outputLabel).add(outputTextField)) .add(browseButton)) .add(layout.sequentialBox(Gap.RELATED).add(buttonSeparator).add(startButton)); setSize(new Dimension(((int) getLayout().preferredLayoutSize(this).getWidth()) + 150, ((int) getLayout().preferredLayoutSize(this).getHeight()) + 50)); setResizable(false); setLocationByPlatform(true); }