Search in sources :

Example 81 with JPanel

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

the class MannWhitneyRanksDialog method createDataSetPanel.

private JPanel createDataSetPanel() {
    JPanel panel = new JPanel(new GridBagLayout());
    panel.setBorder(LookAndFeelUtil.createTitledBorder("Select ranks to use for each data set."));
    int y = 0;
    List<EMDataSet> dataSets = getDataSets();
    for (EMDataSet dataset : dataSets) {
        final String dataSetName = dataset.getName();
        JLabel label = new JLabel(dataSetName + ":");
        JComboBox<String> combo = new JComboBox<>();
        for (String ranksName : dataset.getExpressionSets().getAllRanksNames()) {
            combo.addItem(ranksName);
        }
        SwingUtil.makeSmall(label, combo);
        if (combo.getItemCount() <= 1) {
            combo.setEnabled(false);
        }
        combo.addActionListener(e -> {
            String ranks = combo.getSelectedItem().toString();
            results.put(dataSetName, ranks);
        });
        results.put(dataSetName, combo.getSelectedItem().toString());
        panel.add(label, GBCFactory.grid(0, y).weightx(.5).anchor(EAST).fill(NONE).get());
        panel.add(combo, GBCFactory.grid(1, y).weightx(.5).get());
        y++;
    }
    return panel;
}
Also used : JPanel(javax.swing.JPanel) GridBagLayout(java.awt.GridBagLayout) JComboBox(javax.swing.JComboBox) JLabel(javax.swing.JLabel) EMDataSet(org.baderlab.csplugins.enrichmentmap.model.EMDataSet)

Example 82 with JPanel

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

the class MannWhitneyRanksDialog method createButtonPanel.

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

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

        public void actionPerformed(ActionEvent e) {
            cancelled = true;
            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 83 with JPanel

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

the class PostAnalysisInputPanel method createNamePanel.

private JPanel createNamePanel() {
    nameText = new JTextField();
    makeSmall(nameText);
    JPanel panel = new JPanel();
    panel.setBorder(LookAndFeelUtil.createTitledBorder("Data Set Name (optional)"));
    final GroupLayout layout = new GroupLayout(panel);
    panel.setLayout(layout);
    layout.setAutoCreateContainerGaps(true);
    layout.setAutoCreateGaps(!LookAndFeelUtil.isAquaLAF());
    layout.setHorizontalGroup(layout.createSequentialGroup().addComponent(nameText, DEFAULT_SIZE, DEFAULT_SIZE, Short.MAX_VALUE));
    layout.setVerticalGroup(layout.createParallelGroup(Alignment.CENTER, false).addComponent(nameText, PREFERRED_SIZE, DEFAULT_SIZE, PREFERRED_SIZE));
    if (LookAndFeelUtil.isAquaLAF())
        panel.setOpaque(false);
    return panel;
}
Also used : JPanel(javax.swing.JPanel) GroupLayout(javax.swing.GroupLayout) JTextField(javax.swing.JTextField)

Example 84 with JPanel

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

the class LegendPanelMediator method init.

@AfterInjection
@SuppressWarnings("serial")
private void init() {
    invokeOnEDTAndWait(() -> {
        dialog = new JDialog(swingApplication.getJFrame(), "EnrichmentMap Legend", ModalityType.MODELESS);
        dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
        dialog.setMinimumSize(new Dimension(440, 380));
        JButton closeButton = new JButton(new AbstractAction("Close") {

            @Override
            public void actionPerformed(ActionEvent e) {
                dialog.dispose();
            }
        });
        creationParamsButton.addActionListener(e -> showCreationParamsDialog());
        JPanel bottomPanel = LookAndFeelUtil.createOkCancelPanel(null, closeButton, creationParamsButton);
        dialog.getContentPane().add(legendPanelProvider.get(), BorderLayout.CENTER);
        dialog.getContentPane().add(bottomPanel, BorderLayout.SOUTH);
        LookAndFeelUtil.setDefaultOkCancelKeyStrokes(dialog.getRootPane(), null, closeButton.getAction());
        dialog.getRootPane().setDefaultButton(closeButton);
        dialog.setLocationRelativeTo(swingApplication.getJFrame());
    });
}
Also used : JPanel(javax.swing.JPanel) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) Dimension(java.awt.Dimension) AbstractAction(javax.swing.AbstractAction) JDialog(javax.swing.JDialog) AfterInjection(org.baderlab.csplugins.enrichmentmap.AfterInjection)

Example 85 with JPanel

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

the class EdgeWidthDialog method createButtonPanel.

private JPanel createButtonPanel() {
    JButton restoreDefaultsButton = new JButton("Restore Defaults");
    restoreDefaultsButton.addActionListener(e -> {
        setTextFieldValues(EdgeWidthParams.defaultValues());
    });
    JButton cancelButton = new JButton(new AbstractAction("Cancel") {

        @Override
        public void actionPerformed(ActionEvent e) {
            dispose();
        }
    });
    JButton okButton = new JButton(new AbstractAction("OK") {

        @Override
        public void actionPerformed(ActionEvent e) {
            double emLowerWidth = ((Number) emLowerWidthText.getValue()).doubleValue();
            double emUpperWidth = ((Number) emUpperWidthText.getValue()).doubleValue();
            double lessThan100 = ((Number) lessThan100Text.getValue()).doubleValue();
            double lessThan10 = ((Number) lessThan10Text.getValue()).doubleValue();
            double greaterThan = ((Number) greaterThanText.getValue()).doubleValue();
            EdgeWidthParams params = new EdgeWidthParams(emLowerWidth, emUpperWidth, lessThan100, lessThan10, greaterThan);
            params.save(network);
            Task task = new Task() {

                public void run(TaskMonitor taskMonitor) throws Exception {
                    taskMonitor.setTitle("EnrichmentMap");
                    taskMonitor.setStatusMessage("Calculating Post-Analysis Edge Widths");
                    WidthFunction widthFunction = widthFunctionProvider.get();
                    widthFunction.setEdgeWidths(network, prefix, taskMonitor);
                }

                public void cancel() {
                }
            };
            taskManager.execute(new TaskIterator(task));
            dispose();
        }
    });
    JPanel bottomPanel = LookAndFeelUtil.createOkCancelPanel(okButton, cancelButton, restoreDefaultsButton);
    LookAndFeelUtil.setDefaultOkCancelKeyStrokes(getRootPane(), okButton.getAction(), cancelButton.getAction());
    getRootPane().setDefaultButton(okButton);
    return bottomPanel;
}
Also used : JPanel(javax.swing.JPanel) Task(org.cytoscape.work.Task) TaskIterator(org.cytoscape.work.TaskIterator) ActionEvent(java.awt.event.ActionEvent) TaskMonitor(org.cytoscape.work.TaskMonitor) WidthFunction(org.baderlab.csplugins.enrichmentmap.style.WidthFunction) EdgeWidthParams(org.baderlab.csplugins.enrichmentmap.style.WidthFunction.EdgeWidthParams) JButton(javax.swing.JButton) AbstractAction(javax.swing.AbstractAction)

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