Search in sources :

Example 96 with JPanel

use of javax.swing.JPanel in project EnrichmentMapApp by BaderLab.

the class AddRanksDialog method createButtonPanel.

private JPanel createButtonPanel() {
    okButton = new JButton(new AbstractAction("OK") {

        public void actionPerformed(ActionEvent e) {
            if (validateDuplicateRankName()) {
                loadRanksAndClose();
            }
        }
    });
    JButton cancelButton = new JButton(new AbstractAction("Cancel") {

        public void actionPerformed(ActionEvent e) {
            dispose();
        }
    });
    JPanel buttonPanel = LookAndFeelUtil.createOkCancelPanel(okButton, cancelButton);
    LookAndFeelUtil.setDefaultOkCancelKeyStrokes(getRootPane(), okButton.getAction(), cancelButton.getAction());
    getRootPane().setDefaultButton(okButton);
    okButton.setEnabled(false);
    return buttonPanel;
}
Also used : JPanel(javax.swing.JPanel) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) AbstractAction(javax.swing.AbstractAction)

Example 97 with JPanel

use of javax.swing.JPanel in project EnrichmentMapApp by BaderLab.

the class AddRanksDialog method createContents.

private void createContents() {
    JPanel textFieldPanel = createTextFieldPanel();
    JPanel buttonPanel = createButtonPanel();
    Container contentPane = this.getContentPane();
    GroupLayout layout = new GroupLayout(contentPane);
    contentPane.setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup().addComponent(textFieldPanel).addComponent(buttonPanel));
    layout.setVerticalGroup(layout.createSequentialGroup().addComponent(textFieldPanel).addGap(0, 0, Short.MAX_VALUE).addComponent(buttonPanel));
}
Also used : JPanel(javax.swing.JPanel) Container(java.awt.Container) GroupLayout(javax.swing.GroupLayout)

Example 98 with JPanel

use of javax.swing.JPanel in project EnrichmentMapApp by BaderLab.

the class ControlPanel method getCtrlPanelsContainer.

JPanel getCtrlPanelsContainer() {
    if (ctrlPanelsContainer == null) {
        ctrlPanelsContainer = new JPanel();
        ctrlPanelsContainer.setLayout(cardLayout);
        ctrlPanelsContainer.add(nullViewCtrlPanel, nullViewCtrlPanel.getName());
        if (LookAndFeelUtil.isAquaLAF())
            ctrlPanelsContainer.setOpaque(false);
    }
    return ctrlPanelsContainer;
}
Also used : JPanel(javax.swing.JPanel)

Example 99 with JPanel

use of javax.swing.JPanel in project EnrichmentMapApp by BaderLab.

the class PostAnalysisKnownSignaturePanel method createKnownSignatureGMTPanel.

/**
	 * @return Panel for choosing and loading GMT and SignatureGMT Geneset-Files
	 */
private JPanel createKnownSignatureGMTPanel() {
    knownSignatureGMTFileNameTextField = new JFormattedTextField();
    knownSignatureGMTFileNameTextField.setColumns(15);
    knownSignatureGMTFileNameTextField.setToolTipText(Messages.GMT_INSTRUCTION);
    final Color textFieldForeground = knownSignatureGMTFileNameTextField.getForeground();
    knownSignatureGMTFileNameTextField.addPropertyChangeListener("value", new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent e) {
            // if the text is red set it back to black as soon as the user starts typing
            knownSignatureGMTFileNameTextField.setForeground(textFieldForeground);
        }
    });
    JButton selectSigGMTFileButton = new JButton("Browse...");
    selectSigGMTFileButton.setToolTipText(Messages.GMT_INSTRUCTION);
    selectSigGMTFileButton.setActionCommand("Known Signature");
    selectSigGMTFileButton.addActionListener(e -> {
        parentPanel.chooseGMTFile(knownSignatureGMTFileNameTextField);
    });
    makeSmall(knownSignatureGMTFileNameTextField, selectSigGMTFileButton);
    JPanel panel = new JPanel();
    panel.setBorder(LookAndFeelUtil.createTitledBorder("SigGMT File (contains signature-genesets)"));
    final GroupLayout layout = new GroupLayout(panel);
    panel.setLayout(layout);
    layout.setAutoCreateContainerGaps(true);
    layout.setAutoCreateGaps(!LookAndFeelUtil.isAquaLAF());
    layout.setHorizontalGroup(layout.createSequentialGroup().addComponent(knownSignatureGMTFileNameTextField, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE).addComponent(selectSigGMTFileButton, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE));
    layout.setVerticalGroup(layout.createParallelGroup(Alignment.CENTER, false).addComponent(knownSignatureGMTFileNameTextField, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE).addComponent(selectSigGMTFileButton));
    if (LookAndFeelUtil.isAquaLAF())
        panel.setOpaque(false);
    return panel;
}
Also used : JPanel(javax.swing.JPanel) PropertyChangeEvent(java.beans.PropertyChangeEvent) PropertyChangeListener(java.beans.PropertyChangeListener) Color(java.awt.Color) JFormattedTextField(javax.swing.JFormattedTextField) JButton(javax.swing.JButton) GroupLayout(javax.swing.GroupLayout)

Example 100 with JPanel

use of javax.swing.JPanel in project EnrichmentMapApp by BaderLab.

the class PostAnalysisPanelMediator method showDialog.

@SuppressWarnings("serial")
public void showDialog(Component parent, CyNetworkView netView) {
    final EnrichmentMap map = emManager.getEnrichmentMap(netView.getModel().getSUID());
    invokeOnEDT(() -> {
        final PostAnalysisInputPanel panel = panelFactory.create(map);
        final JDialog dialog = new JDialog(swingApplication.getJFrame(), "Add Signature Gene Sets", ModalityType.APPLICATION_MODAL);
        dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
        JButton helpButton = SwingUtil.createOnlineHelpButton(EnrichmentMapBuildProperties.USER_MANUAL_URL, "Online Manual...", serviceRegistrar);
        JButton resetButton = new JButton("Reset");
        resetButton.addActionListener(e -> panel.reset());
        JButton closeButton = new JButton(new AbstractAction("Close") {

            @Override
            public void actionPerformed(ActionEvent e) {
                dialog.dispose();
            }
        });
        JButton runButton = new JButton(new AbstractAction("Add") {

            @Override
            public void actionPerformed(ActionEvent e) {
                if (panel.isReady()) {
                    Optional<PostAnalysisParameters> params = buildPostAnalysisParameters(panel, map, dialog);
                    if (params.isPresent()) {
                        addGeneSets(netView, params.get());
                        dialog.dispose();
                    } else {
                        JOptionPane.showMessageDialog(panel, "Could not run post analysis.", "EnrichmentMap: Error", JOptionPane.WARNING_MESSAGE);
                    }
                }
            }
        });
        JPanel buttonPanel = LookAndFeelUtil.createOkCancelPanel(runButton, closeButton, helpButton, resetButton);
        dialog.getContentPane().add(panel, BorderLayout.CENTER);
        dialog.getContentPane().add(buttonPanel, BorderLayout.SOUTH);
        LookAndFeelUtil.setDefaultOkCancelKeyStrokes(dialog.getRootPane(), runButton.getAction(), closeButton.getAction());
        dialog.getRootPane().setDefaultButton(runButton);
        dialog.pack();
        dialog.setLocationRelativeTo(swingApplication.getJFrame());
        dialog.setVisible(true);
    });
}
Also used : JPanel(javax.swing.JPanel) Optional(java.util.Optional) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) EnrichmentMap(org.baderlab.csplugins.enrichmentmap.model.EnrichmentMap) AbstractAction(javax.swing.AbstractAction) JDialog(javax.swing.JDialog)

Aggregations

JPanel (javax.swing.JPanel)4487 JLabel (javax.swing.JLabel)1843 BorderLayout (java.awt.BorderLayout)1461 JButton (javax.swing.JButton)1180 Dimension (java.awt.Dimension)1107 GridBagLayout (java.awt.GridBagLayout)1071 ActionEvent (java.awt.event.ActionEvent)1019 GridBagConstraints (java.awt.GridBagConstraints)954 JScrollPane (javax.swing.JScrollPane)901 ActionListener (java.awt.event.ActionListener)871 BoxLayout (javax.swing.BoxLayout)801 Insets (java.awt.Insets)724 FlowLayout (java.awt.FlowLayout)667 JTextField (javax.swing.JTextField)532 JCheckBox (javax.swing.JCheckBox)458 GridLayout (java.awt.GridLayout)375 JComboBox (javax.swing.JComboBox)267 EmptyBorder (javax.swing.border.EmptyBorder)252 JTable (javax.swing.JTable)224 Color (java.awt.Color)210