Add button to the dialog @param label button label @param listener listener to handle the action when pressing the button
(String label, ActionListener listener)
| 472 | * @param listener listener to handle the action when pressing the button |
| 473 | */ |
| 474 | public void addButton(String label, ActionListener listener) { |
| 475 | if (GraphicsEnvironment.isHeadless()) |
| 476 | return; |
| 477 | Button button = new Button(label); |
| 478 | button.addActionListener(listener); |
| 479 | button.addKeyListener(this); |
| 480 | GridBagLayout layout = (GridBagLayout)getLayout(); |
| 481 | Panel panel = new Panel(); |
| 482 | addPanel(panel); |
| 483 | GridBagConstraints constraints = layout.getConstraints(panel); |
| 484 | remove(panel); |
| 485 | layout.setConstraints(button, constraints); |
| 486 | add(button); |
| 487 | } |
| 488 | |
| 489 | /** Adds a popup menu that lists the currently open images. |
| 490 | * Call getNextImage() to retrieve the selected |
nothing calls this directly
no test coverage detected