Search in sources :

Example 26 with ActionEvent

use of java.awt.event.ActionEvent in project ACS by ACS-Community.

the class BeanGrouper method getStopButton.

/**
	 * Initializes the Stop Button, and also performs on click, the stop of the Sampling.
	 * @return javax.swing.JButton Reference to the Stop Button
	 */
private JButton getStopButton() {
    if (stopButton == null) {
        stopButton = new JButton();
        stopButton.setIcon(new ImageIcon(getClass().getClassLoader().getResource("cl/utfsm/samplingSystemUI/img/player_stop.png")));
        stopButton.addActionListener(new java.awt.event.ActionListener() {

            public void actionPerformed(ActionEvent arg0) {
                // Stop the samples
                pauseButton.setEnabled(false);
                stopSample();
                //UnPause the graph, if is already paused
                if (pausedGraph == true) {
                    for (DataPrinter i : samplers) {
                        i.pauseSampling(false);
                    }
                    pausedGraph = false;
                    pauseButton.setSelected(false);
                }
                // Enable/disable buttons
                timeSampSpinner.setEnabled(true);
                freqSpinner.setEnabled(true);
                timeWindowSpinner.setEnabled(true);
                stopButton.setEnabled(false);
            }
        });
    }
    return stopButton;
}
Also used : ImageIcon(javax.swing.ImageIcon) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton)

Example 27 with ActionEvent

use of java.awt.event.ActionEvent in project ACS by ACS-Community.

the class BeanGrouper method createDelPropWindow.

private void createDelPropWindow() {
    if (frame != null) {
        return;
    }
    JLabel delLabel = new JLabel("Select the Component:Property to delete:");
    jcombo = new JComboBox();
    frame = new JFrame("Delete");
    JPanel panel = new JPanel(new BorderLayout(5, 5));
    JButton delButton = new JButton("Delete");
    for (DataPrinter wp : samplers) {
        jcombo.addItem(wp.component + ":" + wp.property);
    }
    delButton.addActionListener(new java.awt.event.ActionListener() {

        public void actionPerformed(ActionEvent e) {
            String[] comProp = new String[2];
            comProp = jcombo.getSelectedItem().toString().split(":");
            removeSamp(comProp[0], comProp[1]);
            jcombo.removeItemAt(jcombo.getSelectedIndex());
            addToStatusList(comProp[0] + "#" + comProp[1] + "removed");
        }
    });
    delLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    panel.add(delLabel, BorderLayout.NORTH);
    jcombo.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    panel.add(jcombo, BorderLayout.CENTER);
    delButton.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    panel.add(delButton, BorderLayout.EAST);
    //frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
    frame.add(panel);
    frame.pack();
    frame.setVisible(true);
    frame.addWindowListener(new java.awt.event.WindowListener() {

        @Override
        public void windowActivated(WindowEvent e) {
        }

        @Override
        public void windowClosed(WindowEvent e) {
        }

        @Override
        public void windowClosing(WindowEvent e) {
        }

        @Override
        public void windowDeactivated(WindowEvent e) {
            frame = null;
        }

        @Override
        public void windowDeiconified(WindowEvent e) {
        }

        @Override
        public void windowIconified(WindowEvent e) {
        }

        @Override
        public void windowOpened(WindowEvent e) {
        }
    });
}
Also used : JPanel(javax.swing.JPanel) JComboBox(javax.swing.JComboBox) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) JLabel(javax.swing.JLabel) BorderLayout(java.awt.BorderLayout) JFrame(javax.swing.JFrame) WindowListener(java.awt.event.WindowListener) WindowEvent(java.awt.event.WindowEvent)

Example 28 with ActionEvent

use of java.awt.event.ActionEvent 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 29 with ActionEvent

use of java.awt.event.ActionEvent 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 30 with ActionEvent

use of java.awt.event.ActionEvent 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

ActionEvent (java.awt.event.ActionEvent)3561 ActionListener (java.awt.event.ActionListener)2755 JButton (javax.swing.JButton)1116 JPanel (javax.swing.JPanel)961 JLabel (javax.swing.JLabel)606 JMenuItem (javax.swing.JMenuItem)550 Dimension (java.awt.Dimension)531 AbstractAction (javax.swing.AbstractAction)510 BorderLayout (java.awt.BorderLayout)381 GridBagConstraints (java.awt.GridBagConstraints)301 GridBagLayout (java.awt.GridBagLayout)292 Insets (java.awt.Insets)288 JScrollPane (javax.swing.JScrollPane)274 BoxLayout (javax.swing.BoxLayout)262 JTextField (javax.swing.JTextField)262 FlowLayout (java.awt.FlowLayout)257 JCheckBox (javax.swing.JCheckBox)242 JMenu (javax.swing.JMenu)217 Point (java.awt.Point)203 ImageIcon (javax.swing.ImageIcon)191