List of usage examples for javax.swing JCheckBox JCheckBox
public JCheckBox(Action a)
From source file:net.sf.mzmine.modules.peaklistmethods.peakpicking.adap3decompositionV2.ADAP3DecompositionV2SetupDialog.java
/** Creates the interface elements */ @Override//from ww w. j a va 2 s. c o m protected void addDialogComponents() { super.addDialogComponents(); comboClustersModel = new DefaultComboBoxModel<>(); PeakList[] peakLists = MZmineCore.getDesktop().getSelectedPeakLists(); // ----------------------------- // Panel with preview UI elements // ----------------------------- // Preview CheckBox chkPreview = new JCheckBox("Show preview"); chkPreview.addActionListener(this); chkPreview.setHorizontalAlignment(SwingConstants.CENTER); chkPreview.setEnabled(peakLists != null && peakLists.length > 0); // Preview panel that will contain ComboBoxes final JPanel panel = new JPanel(new BorderLayout()); panel.add(new JSeparator(), BorderLayout.NORTH); panel.add(chkPreview, BorderLayout.CENTER); panel.add(Box.createVerticalStrut(10), BorderLayout.SOUTH); pnlUIElements = new JPanel(new BorderLayout()); pnlUIElements.add(panel, BorderLayout.NORTH); // ComboBox with Clusters cboClusters = new JComboBox<>(comboClustersModel); cboClusters.setFont(COMBO_FONT); cboClusters.addActionListener(this); pnlComboBoxes = GUIUtils.makeTablePanel(1, 2, new JComponent[] { new JLabel("Clusters"), cboClusters }); // -------------------------------------------------------------------- // ----- Panel with plots -------------------------------------- // -------------------------------------------------------------------- pnlPlots = new JPanel(); pnlPlots.setLayout(new BoxLayout(pnlPlots, BoxLayout.Y_AXIS)); // Plot with retention-time clusters retTimeMZPlot = new SimpleScatterPlot("Retention time", "m/z"); retTimeMZPlot.setMinimumSize(MIN_DIMENSIONS); final JPanel pnlPlotRetTimeClusters = new JPanel(new BorderLayout()); pnlPlotRetTimeClusters.setBackground(Color.white); pnlPlotRetTimeClusters.add(retTimeMZPlot, BorderLayout.CENTER); GUIUtils.addMarginAndBorder(pnlPlotRetTimeClusters, 10); // Plot with chromatograms retTimeIntensityPlot = new EICPlot(); retTimeIntensityPlot.setMinimumSize(MIN_DIMENSIONS); JPanel pnlPlotShapeClusters = new JPanel(new BorderLayout()); pnlPlotShapeClusters.setBackground(Color.white); pnlPlotShapeClusters.add(retTimeIntensityPlot, BorderLayout.CENTER); GUIUtils.addMarginAndBorder(pnlPlotShapeClusters, 10); pnlPlots.add(pnlPlotRetTimeClusters); pnlPlots.add(pnlPlotShapeClusters); super.mainPanel.add(pnlUIElements, 0, super.getNumberOfParameters() + 3, 2, 1, 0, 0, GridBagConstraints.HORIZONTAL); }
From source file:org.fhaes.FHRecorder.FireHistoryRecorder.java
private void initComponents() { addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { closeAfterRunningChecks();//from w ww. j ava 2s .c o m } }); setMinimumSize(new java.awt.Dimension(950, 675)); setResizable(true); getContentPane().setLayout(new MigLayout("", "[810px,grow]", "[466.00,grow][42.00]")); tabbedPane = new JTabbedPane(JTabbedPane.TOP); getContentPane().add(tabbedPane, "cell 0 0,grow"); sampleInputHolder = new JPanel(); siteInfoHolder = new JPanel(); sampleInputHolder.setLayout(new BorderLayout()); siteInfoHolder.setLayout(new BorderLayout()); tabbedPane.addTab("Data", null, sampleInputHolder, null); tabbedPane.addTab("Metadata", null, siteInfoHolder, null); summaryHolder = new JPanel(); tabbedPane.addTab("Summary", null, summaryHolder, null); graphicsHolder = new JPanel(); tabbedPane.addTab("Graphics", null, graphicsHolder, null); graphicsHolder.setLayout(new BorderLayout(0, 0)); chartScrollBar = new JScrollBar(); chartScrollBar.setMaximum(110); chartScrollBar.addAdjustmentListener(new AdjustmentListener() { public void adjustmentValueChanged(AdjustmentEvent arg0) { if (graphicsPanel != null) { graphicsPanel.updateVisibleYears(chartScrollBar.getValue()); } } }); chartScrollBar.setOrientation(JScrollBar.HORIZONTAL); graphicsHolder.add(chartScrollBar, BorderLayout.SOUTH); fileErrorHolder = new JPanel(); tabbedPane.addTab("File Errors", null, fileErrorHolder, null); panelButtonBar = new JPanel(); getContentPane().add(panelButtonBar, "cell 0 1,alignx right,growy"); useLimitsCheckBox = new JCheckBox("Keep FHX2 Limitations"); panelButtonBar.add(useLimitsCheckBox); useLimitsCheckBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { siteInfo.setLimitRestriction(useLimitsCheckBox.isSelected()); } }); btnSave = new JButton("Save"); panelButtonBar.add(btnSave); btnSave.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { saveMenuItemActionPerformed(e); } }); btnClose = new JButton("Close"); btnClose.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { closeAfterRunningChecks(); } }); panelButtonBar.add(btnClose); btnCancel = new JButton("Discard changes"); panelButtonBar.add(btnCancel); btnCancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { Controller.filePath = null; setVisible(false); } }); pack(); }
From source file:EditorPaneExample20.java
public EditorPaneExample20() { super("JEditorPane Example 20"); pane = new JEditorPane(); pane.setEditable(true); // Editable getContentPane().add(new JScrollPane(pane), "Center"); // Add a menu bar menuBar = new JMenuBar(); setJMenuBar(menuBar);/*from w w w .j a v a2s . com*/ // Populate it createMenuBar(); // Build the panel of controls JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.gridwidth = 1; c.gridheight = 1; c.anchor = GridBagConstraints.EAST; c.fill = GridBagConstraints.NONE; c.weightx = 0.0; c.weighty = 0.0; JLabel urlLabel = new JLabel("URL: ", JLabel.RIGHT); panel.add(urlLabel, c); JLabel loadingLabel = new JLabel("State: ", JLabel.RIGHT); c.gridy = 1; panel.add(loadingLabel, c); JLabel typeLabel = new JLabel("Type: ", JLabel.RIGHT); c.gridy = 2; panel.add(typeLabel, c); c.gridy = 3; panel.add(new JLabel(LOAD_TIME), c); c.gridy = 4; c.gridwidth = 2; c.weightx = 1.0; c.anchor = GridBagConstraints.WEST; onlineLoad = new JCheckBox("Online Load"); panel.add(onlineLoad, c); onlineLoad.setSelected(true); onlineLoad.setForeground(typeLabel.getForeground()); c.gridy = 5; c.gridwidth = 2; c.weightx = 1.0; c.anchor = GridBagConstraints.WEST; editableBox = new JCheckBox("Editable JEditorPane"); panel.add(editableBox, c); editableBox.setSelected(true); editableBox.setForeground(typeLabel.getForeground()); c.gridy = 6; c.weightx = 0.0; JButton saveButton = new JButton("Save"); panel.add(saveButton, c); saveButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { EditorKit kit = pane.getEditorKit(); try { if (kit instanceof RTFEditorKit) { kit.write(System.out, pane.getDocument(), 0, pane.getDocument().getLength()); System.out.flush(); } else { if (writer == null) { writer = new OutputStreamWriter(System.out); pane.write(writer); writer.flush(); } kit.write(writer, pane.getDocument(), 0, pane.getDocument().getLength()); writer.flush(); } } catch (Exception e) { System.out.println("Write failed"); } } }); c.gridx = 1; insertButton = new JButton("Insert HTML"); panel.add(insertButton, c); insertButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (insertFrame == null) { insertFrame = new HTMLInsertFrame("HTML Insertion", pane); Point pt = EditorPaneExample20.this.getLocationOnScreen(); Dimension d = EditorPaneExample20.this.getSize(); insertFrame.setLocation(pt.x + d.width, pt.y); insertFrame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent evt) { insertFrame.dispose(); insertFrame = null; setInsertButtonState(); } }); insertButton.setEnabled(false); insertFrame.setVisible(true); } } }); insertButton.setEnabled(false); c.gridx = 1; c.gridy = 0; c.weightx = 1.0; c.anchor = GridBagConstraints.EAST; c.fill = GridBagConstraints.HORIZONTAL; urlCombo = new JComboBox(); panel.add(urlCombo, c); urlCombo.setEditable(true); loadingState = new JLabel(spaces, JLabel.LEFT); loadingState.setForeground(Color.black); c.gridy = 1; panel.add(loadingState, c); loadedType = new JLabel(spaces, JLabel.LEFT); loadedType.setForeground(Color.black); c.gridy = 2; panel.add(loadedType, c); timeLabel = new JLabel(""); c.gridy = 3; panel.add(timeLabel, c); getContentPane().add(panel, "South"); // Register a custom EditorKit for HTML ClassLoader loader = getClass().getClassLoader(); if (loader != null) { // Java 2 JEditorPane.registerEditorKitForContentType("text/html", "AdvancedSwing.Chapter4.EnhancedHTMLEditorKit", loader); } else { // JDK 1.1 JEditorPane.registerEditorKitForContentType("text/html", "AdvancedSwing.Chapter4.EnhancedHTMLEditorKit"); } // Allocate the empty tree model DefaultMutableTreeNode emptyRootNode = new DefaultMutableTreeNode("Empty"); emptyModel = new DefaultTreeModel(emptyRootNode); // Create and place the heading tree tree = new JTree(emptyModel); tree.setPreferredSize(new Dimension(200, 200)); getContentPane().add(new JScrollPane(tree), "East"); // Change page based on combo selection urlCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (populatingCombo == true) { return; } Object selection = urlCombo.getSelectedItem(); loadNewPage(selection); } }); // Change editability based on the checkbox editableBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { pane.setEditable(editableBox.isSelected()); pane.revalidate(); pane.repaint(); } }); // Listen for page load to complete pane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("page")) { loadComplete(); displayLoadTime(); populateCombo(findLinks(pane.getDocument(), null)); TreeNode node = buildHeadingTree(pane.getDocument()); tree.setModel(new DefaultTreeModel(node)); createMenuBar(); enableMenuBar(true); getRootPane().revalidate(); enableInput(); loadingPage = false; } } }); // Listener for tree selection tree.addTreeSelectionListener(new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent evt) { TreePath path = evt.getNewLeadSelectionPath(); if (path != null) { DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent(); Object userObject = node.getUserObject(); if (userObject instanceof Heading) { Heading heading = (Heading) userObject; try { Rectangle textRect = pane.modelToView(heading.getOffset()); textRect.y += 3 * textRect.height; pane.scrollRectToVisible(textRect); } catch (BadLocationException e) { } } } } }); // Listener for hypertext events pane.addHyperlinkListener(new HyperlinkListener() { public void hyperlinkUpdate(HyperlinkEvent evt) { // Ignore hyperlink events if the frame is busy if (loadingPage == true) { return; } if (evt.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { JEditorPane sp = (JEditorPane) evt.getSource(); if (evt instanceof HTMLFrameHyperlinkEvent) { HTMLDocument doc = (HTMLDocument) sp.getDocument(); doc.processHTMLFrameHyperlinkEvent((HTMLFrameHyperlinkEvent) evt); } else { loadNewPage(evt.getURL()); } } else if (evt.getEventType() == HyperlinkEvent.EventType.ENTERED) { pane.setCursor(handCursor); } else if (evt.getEventType() == HyperlinkEvent.EventType.EXITED) { pane.setCursor(defaultCursor); } } }); }
From source file:ca.phon.app.query.SaveQueryDialog.java
private void init() { // final PathExpander pe = new PathExpander(); nameField = new JTextField(); nameField.getDocument().addDocumentListener(new DocumentListener() { @Override/* w w w .ja v a 2 s .com*/ public void insertUpdate(DocumentEvent de) { updateLocationFields(); } @Override public void removeUpdate(DocumentEvent de) { updateLocationFields(); } @Override public void changedUpdate(DocumentEvent de) { updateLocationFields(); } }); includeFormOptionsBox = new JCheckBox("Include current form settings"); includeFormOptionsBox.setSelected(true); ButtonGroup btnGrp = new ButtonGroup(); saveInProjectBtn = new JRadioButton("Save in project resources"); btnGrp.add(saveInProjectBtn); saveInUserDirBtn = new JRadioButton("Save in user library"); btnGrp.add(saveInUserDirBtn); saveOtherBtn = new JRadioButton("Save in another location..."); btnGrp.add(saveOtherBtn); saveInUserDirBtn.setSelected(true); projSaveLocField = new JLabel(); // projSaveLocField.setFont(projSaveLocField.getFont().deriveFont(10.0f)); libSaveLocField = new JLabel(); // libSaveLocField.setFont(libSaveLocField.getFont().deriveFont(10.0f)); updateLocationFields(); saveBtn = new JButton("Save"); saveBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { save(); } }); super.getRootPane().setDefaultButton(saveBtn); cancelBtn = new JButton("Cancel"); cancelBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { setVisible(false); } }); final DialogHeader header = new DialogHeader("Save Query", ""); JComponent btnBar = ButtonBarBuilder.buildOkCancelBar(saveBtn, cancelBtn); final FormLayout formLayout = new FormLayout("3dlu, 12dlu, fill:pref:grow, 3dlu", "pref, pref, pref, pref, pref, pref, pref, pref, pref, pref"); final CellConstraints cc = new CellConstraints(); setLayout(formLayout); add(header, cc.xyw(2, 1, 2)); add(new JLabel("Name: (without extension)"), cc.xyw(2, 2, 2)); add(nameField, cc.xy(3, 3)); add(includeFormOptionsBox, cc.xy(3, 4)); add(saveInUserDirBtn, cc.xyw(2, 5, 2)); // add(libSaveLocField, cc.xy(3, 6)); add(saveInProjectBtn, cc.xyw(2, 7, 2)); // add(projSaveLocField, cc.xy(3, 8)); add(saveOtherBtn, cc.xyw(2, 9, 2)); add(btnBar, cc.xyw(2, 10, 2)); }
From source file:it.cnr.icar.eric.client.ui.swing.FindParamsPanel.java
/** * Class Constructor.// w w w . ja va2s . co m */ public FindParamsPanel(DiscoveryPanel discoveryPanel) throws JAXRException { this.discoveryPanel = discoveryPanel; GridBagLayout gbl = new GridBagLayout(); setLayout(gbl); //The searchTypeSelectionPanel at the top of the panel JPanel searchTypePanel = createSearchTypePanel(); c.gridx = 0; c.gridy = 0; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.0; c.weighty = 0.0; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.NORTH; c.insets = new Insets(4, 4, 0, 4); gbl.setConstraints(searchTypePanel, c); add(searchTypePanel); //The federated CheckBox federatedCheckBox = new JCheckBox(resourceBundle.getString("label.federatedQuery")); federatedCheckBox.setSelected(false); federatedCheckBox.setEnabled(true); c.gridx = 0; c.gridy = 1; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.0; c.weighty = 0.0; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.NORTH; c.insets = new Insets(4, 4, 0, 4); gbl.setConstraints(federatedCheckBox, c); add(federatedCheckBox); //The actionPanel JPanel actionPanel = createActionPanel(); c.gridx = 0; c.gridy = 2; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.0; c.weighty = 0.0; c.fill = GridBagConstraints.NONE; c.anchor = GridBagConstraints.NORTH; c.insets = new Insets(4, 4, 0, 4); gbl.setConstraints(searchTypePanel, c); add(actionPanel); //Next is the panel that is the parent of both adhocQueryPanel and //businessQueryPanel paramEntryParentPanel = createParamEntryParentPanel(); c.gridx = 0; c.gridy = 3; c.gridwidth = 1; c.gridheight = 1; c.weightx = 0.5; c.weighty = 0.5; c.fill = GridBagConstraints.BOTH; c.anchor = GridBagConstraints.NORTH; c.insets = new Insets(4, 4, 0, 4); gbl.setConstraints(paramEntryParentPanel, c); add(paramEntryParentPanel); //RegistryBrowser.getInstance().getConceptsTreeDialog().addPropertyChangeListener(this); //add listener for 'locale' bound property RegistryBrowser.getInstance().addPropertyChangeListener(RegistryBrowser.PROPERTY_LOCALE, this); }
From source file:jgnash.ui.report.compiled.MonthlyAccountBalanceChartCompare.java
private JPanel createPanel() { LocalDate end = DateUtils.getLastDayOfTheMonth(endDateField.getLocalDate()); LocalDate start = end.minusYears(1); startDateField.setDate(start);//from ww w . j a v a 2s.com JButton refreshButton = new JButton(rb.getString("Button.Refresh")); refreshButton.setIcon(IconUtils.getIcon("/jgnash/resource/view-refresh.png")); subAccountCheckBox = new JCheckBox(rb.getString("Button.IncludeSubAccounts")); subAccountCheckBox.setSelected(true); hideLockedAccountCheckBox = new JCheckBox(rb.getString("Button.HideLockedAccount")); hidePlaceholderAccountCheckBox = new JCheckBox(rb.getString("Button.HidePlaceholderAccount")); jcb_compare = new JCheckBox(rb.getString("Button.Compare")); jcb_compare.setSelected(true); Account a = combo1.getSelectedAccount(); Account a2 = combo2.getSelectedAccount(); JFreeChart chart = createVerticalXYBarChart(a, a2); final ChartPanel chartPanel = new ChartPanel(chart); FormLayout layout = new FormLayout("p, 4dlu, p:g", ""); DefaultFormBuilder builder = new DefaultFormBuilder(layout); FormLayout dLayout = new FormLayout("p, 4dlu, p, 8dlu, p, 4dlu, p, 8dlu, p", ""); DefaultFormBuilder dBuilder = new DefaultFormBuilder(dLayout); dBuilder.append(rb.getString("Label.StartDate"), startDateField); dBuilder.append(rb.getString("Label.EndDate"), endDateField); dBuilder.append(refreshButton); FormLayout cbLayout = new FormLayout("p, 4dlu, p, 4dlu, p, 4dlu", ""); DefaultFormBuilder cbBuilder = new DefaultFormBuilder(cbLayout); cbBuilder.append(subAccountCheckBox); cbBuilder.append(hideLockedAccountCheckBox); cbBuilder.append(hidePlaceholderAccountCheckBox); builder.append(rb.getString("Label.Account"), combo1); builder.nextLine(); builder.append(rb.getString("Label.Compare"), combo2); builder.nextLine(); builder.append(jcb_compare); builder.append(cbBuilder.getPanel()); builder.nextLine(); builder.appendRelatedComponentsGapRow(); builder.nextLine(); builder.append(dBuilder.getPanel(), 3); builder.nextLine(); builder.appendUnrelatedComponentsGapRow(); builder.nextLine(); builder.appendRow(RowSpec.decode("fill:p:g")); builder.append(chartPanel, 3); final JPanel panel = builder.getPanel(); ActionListener listener = e -> { try { if (e.getSource() == jcb_compare) { combo2.setEnabled(jcb_compare.isSelected()); } Account account = combo1.getSelectedAccount(); if (account == null) { return; } Account account2 = combo2.getSelectedAccount(); if (jcb_compare.isSelected() && account2 == null) { return; } updateSubAccountBox(); chartPanel.setChart(createVerticalXYBarChart(account, account2)); panel.validate(); } catch (final Exception ex) { Logger.getLogger(MonthlyAccountBalanceChartCompare.class.getName()).log(Level.SEVERE, ex.getLocalizedMessage(), ex); } }; combo1.addActionListener(listener); combo2.addActionListener(listener); jcb_compare.addActionListener(listener); subAccountCheckBox.addActionListener(listener); hideLockedAccountCheckBox.addActionListener(e -> { combo1.setHideLocked(hideLockedAccountCheckBox.isSelected()); combo2.setHideLocked(hideLockedAccountCheckBox.isSelected()); try { Account account = combo1.getSelectedAccount(); if (account == null) { return; } Account account2 = combo2.getSelectedAccount(); if (jcb_compare.isSelected() && account2 == null) { return; } updateSubAccountBox(); chartPanel.setChart(createVerticalXYBarChart(account, account2)); panel.validate(); } catch (final Exception ex) { Logger.getLogger(MonthlyAccountBalanceChartCompare.class.getName()).log(Level.SEVERE, ex.getLocalizedMessage(), ex); } }); hidePlaceholderAccountCheckBox.addActionListener(e -> { combo1.setHidePlaceholder(hidePlaceholderAccountCheckBox.isSelected()); combo2.setHidePlaceholder(hidePlaceholderAccountCheckBox.isSelected()); try { Account account = combo1.getSelectedAccount(); if (account == null) { return; } Account account2 = combo2.getSelectedAccount(); if (jcb_compare.isSelected() && account2 == null) { return; } updateSubAccountBox(); chartPanel.setChart(createVerticalXYBarChart(account, account2)); panel.validate(); } catch (final Exception ex) { Logger.getLogger(MonthlyAccountBalanceChartCompare.class.getName()).log(Level.SEVERE, ex.getLocalizedMessage(), ex); } }); refreshButton.addActionListener(listener); updateSubAccountBox(); return panel; }
From source file:eu.europa.ec.markt.dss.applet.util.ComponentFactory.java
/** * /*from w w w. j a va2 s .c o m*/ * @param text * @param actionListener * @return */ public static JCheckBox checkButton(final String text, final ActionListener actionListener) { final JCheckBox check = new JCheckBox(text); check.addActionListener(actionListener); return check; }
From source file:utilities.GraphViewer.java
public void addSensor(String fichier) { // ajouter le graphe ajouterFichier(fichier);//from w w w .j a v a 2 s . c o m // this.paneGraphe.add(graphe()); graphe.revalidate(); db.add(this.getSensorName(fichier), fichier); // ajouter un element a la list JCheckBox chckbxNewCheckBox = new JCheckBox(this.getSensorName(fichier)); this.sensors.add(chckbxNewCheckBox); this.sensors1.add(chckbxNewCheckBox); chckbxNewCheckBox.setBackground(new Color(200, 200, 255)); chckbxNewCheckBox.setBorder(new LineBorder(Color.BLACK)); chckbxNewCheckBox.setSelected(true); chckbxNewCheckBox.addActionListener(this); JLabel l = new JLabel(" "); l.setPreferredSize(new Dimension(50, 5)); this.sensorsList.add(l); this.sensorsList.add(chckbxNewCheckBox); this.sensorsList.validate(); }
From source file:net.sf.mzmine.modules.peaklistmethods.peakpicking.adap3decompositionV1_5.ADAP3DecompositionV1_5SetupDialog.java
@Override protected void addDialogComponents() { super.addDialogComponents(); comboPeakList = new JComboBox<>(); comboClustersModel = new DefaultComboBoxModel<>(); comboClusters = new JComboBox<>(comboClustersModel); retTimeMZPlot = new SimpleScatterPlot("Retention time", "m/z"); retTimeIntensityPlot = new EICPlot(); PeakList[] peakLists = MZmineCore.getDesktop().getSelectedPeakLists(); // ----------------------------- // Panel with preview parameters // ----------------------------- preview = new JCheckBox("Show preview"); preview.addActionListener(this); preview.setHorizontalAlignment(SwingConstants.CENTER); if (peakLists == null || peakLists.length == 0) preview.setEnabled(false);//from ww w.j a v a 2 s . c om else preview.setEnabled(true); final JPanel previewPanel = new JPanel(new BorderLayout()); previewPanel.add(new JSeparator(), BorderLayout.NORTH); previewPanel.add(preview, BorderLayout.CENTER); previewPanel.add(Box.createVerticalStrut(10), BorderLayout.SOUTH); comboPeakList.setFont(COMBO_FONT); for (final PeakList peakList : peakLists) if (peakList.getNumberOfRawDataFiles() == 1) comboPeakList.addItem(peakList); comboPeakList.addActionListener(this); comboClusters.setFont(COMBO_FONT); comboClusters.addActionListener(this); pnlLabelsFields = GUIUtils.makeTablePanel(2, 2, new JComponent[] { new JLabel("Peak list"), comboPeakList, new JLabel("Cluster list"), comboClusters }); pnlVisible = new JPanel(new BorderLayout()); pnlVisible.add(previewPanel, BorderLayout.NORTH); // -------------------------------------------------------------------- // ----- Tabbed panel with plots -------------------------------------- // -------------------------------------------------------------------- // pnlTabs = new JTabbedPane(); pnlTabs = new JPanel(); pnlTabs.setLayout(new BoxLayout(pnlTabs, BoxLayout.Y_AXIS)); retTimeMZPlot.setMinimumSize(MIN_DIMENSIONS); JPanel pnlPlotRetTimeClusters = new JPanel(new BorderLayout()); pnlPlotRetTimeClusters.setBackground(Color.white); pnlPlotRetTimeClusters.add(retTimeMZPlot, BorderLayout.CENTER); GUIUtils.addMarginAndBorder(pnlPlotRetTimeClusters, 10); pnlTabs.add(pnlPlotRetTimeClusters); retTimeIntensityPlot.setMinimumSize(MIN_DIMENSIONS); JPanel pnlPlotShapeClusters = new JPanel(new BorderLayout()); pnlPlotShapeClusters.setBackground(Color.white); pnlPlotShapeClusters.add(retTimeIntensityPlot, BorderLayout.CENTER); GUIUtils.addMarginAndBorder(pnlPlotShapeClusters, 10); pnlTabs.add(pnlPlotShapeClusters); super.mainPanel.add(pnlVisible, 0, super.getNumberOfParameters() + 3, 2, 1, 0, 0, GridBagConstraints.HORIZONTAL); }
From source file:au.org.ala.delta.intkey.ui.FindInCharactersDialog.java
public FindInCharactersDialog(Intkey intkeyApp, IntkeyContext context) { super(intkeyApp.getMainFrame(), false); setResizable(false);/* w ww . j a va 2s.c o m*/ ResourceMap resourceMap = Application.getInstance().getContext() .getResourceMap(FindInCharactersDialog.class); resourceMap.injectFields(this); ActionMap actionMap = Application.getInstance().getContext().getActionMap(this); _intkeyApp = intkeyApp; _numMatchedCharacters = 0; _currentMatchedCharacter = -1; _findAction = actionMap.get("findCharacters"); _nextAction = actionMap.get("nextCharacter"); this.setTitle(windowTitle); _pnlMain = new JPanel(); _pnlMain.setBorder(new EmptyBorder(20, 20, 20, 20)); getContentPane().add(_pnlMain, BorderLayout.CENTER); _pnlMain.setLayout(new BorderLayout(0, 0)); _pnlMainTop = new JPanel(); _pnlMain.add(_pnlMainTop, BorderLayout.NORTH); _pnlMainTop.setLayout(new BoxLayout(_pnlMainTop, BoxLayout.Y_AXIS)); _lblEnterSearchString = new JLabel(enterSearchStringCaption); _lblEnterSearchString.setBorder(new EmptyBorder(0, 0, 5, 0)); _pnlMainTop.add(_lblEnterSearchString); _textField = new JTextField(); _pnlMainTop.add(_textField); _textField.setColumns(10); _textField.getDocument().addDocumentListener(new DocumentListener() { @Override public void removeUpdate(DocumentEvent e) { reset(); } @Override public void insertUpdate(DocumentEvent e) { reset(); } @Override public void changedUpdate(DocumentEvent e) { reset(); } }); _pnlMainBottom = new JPanel(); _pnlMainBottom.setBorder(new EmptyBorder(20, 0, 0, 0)); _pnlMain.add(_pnlMainBottom, BorderLayout.CENTER); _pnlMainBottom.setLayout(new BoxLayout(_pnlMainBottom, BoxLayout.Y_AXIS)); _chckbxSearchStates = new JCheckBox(searchStatesCaption); _chckbxSearchStates.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { reset(); } }); _pnlMainBottom.add(_chckbxSearchStates); _chckbxSearchUsedCharacters = new JCheckBox(searchUsedCharactersCaption); _chckbxSearchUsedCharacters.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { reset(); } }); _pnlMainBottom.add(_chckbxSearchUsedCharacters); _pnlButtons = new JPanel(); _pnlButtons.setBorder(new EmptyBorder(20, 0, 0, 10)); getContentPane().add(_pnlButtons, BorderLayout.EAST); _pnlButtons.setLayout(new BorderLayout(0, 0)); _pnlInnerButtons = new JPanel(); _pnlButtons.add(_pnlInnerButtons, BorderLayout.NORTH); GridBagLayout gbl__pnlInnerButtons = new GridBagLayout(); gbl__pnlInnerButtons.columnWidths = new int[] { 0, 0 }; gbl__pnlInnerButtons.rowHeights = new int[] { 0, 0, 0, 0 }; gbl__pnlInnerButtons.columnWeights = new double[] { 0.0, Double.MIN_VALUE }; gbl__pnlInnerButtons.rowWeights = new double[] { 0.0, 0.0, 0.0, Double.MIN_VALUE }; _pnlInnerButtons.setLayout(gbl__pnlInnerButtons); _btnFindNext = new JButton(); _btnFindNext.setAction(_findAction); GridBagConstraints gbc__btnFindNext = new GridBagConstraints(); gbc__btnFindNext.fill = GridBagConstraints.HORIZONTAL; gbc__btnFindNext.insets = new Insets(0, 0, 5, 0); gbc__btnFindNext.gridx = 0; gbc__btnFindNext.gridy = 0; _pnlInnerButtons.add(_btnFindNext, gbc__btnFindNext); _btnPrevious = new JButton(); _btnPrevious.setAction(actionMap.get("previousCharacter")); _btnPrevious.setEnabled(false); GridBagConstraints gbc__btnPrevious = new GridBagConstraints(); gbc__btnPrevious.insets = new Insets(0, 0, 5, 0); gbc__btnPrevious.gridx = 0; gbc__btnPrevious.gridy = 1; _pnlInnerButtons.add(_btnPrevious, gbc__btnPrevious); _btnDone = new JButton(); _btnDone.setAction(actionMap.get("findCharactersDone")); GridBagConstraints gbc__btnDone = new GridBagConstraints(); gbc__btnDone.fill = GridBagConstraints.HORIZONTAL; gbc__btnDone.gridx = 0; gbc__btnDone.gridy = 2; _pnlInnerButtons.add(_btnDone, gbc__btnDone); this.pack(); this.setLocationRelativeTo(_intkeyApp.getMainFrame()); }