use of javax.swing.AbstractAction in project EnrichmentMapApp by BaderLab.
the class CardDialog method createButtonPanel.
@SuppressWarnings("serial")
private JPanel createButtonPanel() {
finishButton = new JButton(new AbstractAction(params.getFinishButtonText()) {
public void actionPerformed(ActionEvent e) {
currentPage.finish();
}
});
JButton cancelButton = new JButton(new AbstractAction("Cancel") {
public void actionPerformed(ActionEvent e) {
dialog.setVisible(false);
}
});
AbstractButton[] additional = params.getAdditionalButtons();
if (additional != null) {
for (AbstractButton button : additional) {
button.addActionListener(e -> {
currentPage.extraButtonClicked(e.getActionCommand());
});
}
}
JPanel buttonPanel = LookAndFeelUtil.createOkCancelPanel(finishButton, cancelButton, additional);
LookAndFeelUtil.setDefaultOkCancelKeyStrokes(dialog.getRootPane(), finishButton.getAction(), cancelButton.getAction());
dialog.getRootPane().setDefaultButton(finishButton);
return buttonPanel;
}
use of javax.swing.AbstractAction 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 javax.swing.AbstractAction 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 javax.swing.AbstractAction 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;
}
use of javax.swing.AbstractAction in project jmeter by apache.
the class SelectTemplatesDialog method createRootPane.
@Override
protected JRootPane createRootPane() {
JRootPane rootPane = new JRootPane();
// Hide Window on ESC
Action escapeAction = new //$NON-NLS-1$
AbstractAction(//$NON-NLS-1$
"ESCAPE") {
/**
*
*/
private static final long serialVersionUID = -6543764044868772971L;
@Override
public void actionPerformed(ActionEvent actionEvent) {
setVisible(false);
}
};
// Do search on Enter
Action enterAction = new //$NON-NLS-1$
AbstractAction(//$NON-NLS-1$
"ENTER") {
private static final long serialVersionUID = -3661361497864527363L;
@Override
public void actionPerformed(final ActionEvent actionEvent) {
checkDirtyAndLoad(actionEvent);
}
};
ActionMap actionMap = rootPane.getActionMap();
actionMap.put(escapeAction.getValue(Action.NAME), escapeAction);
actionMap.put(enterAction.getValue(Action.NAME), enterAction);
InputMap inputMap = rootPane.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
inputMap.put(KeyStrokes.ESC, escapeAction.getValue(Action.NAME));
inputMap.put(KeyStrokes.ENTER, enterAction.getValue(Action.NAME));
return rootPane;
}
Aggregations