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;
}
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) {
}
});
}
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;
}
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());
});
}
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;
}
Aggregations