June 2017
Beginner
1296 pages
69h 23m
English
... 45 JOptionPane.showMessageDialog(ButtonFrame.this, String.format(
46 "You pressed: %s", event.getActionCommand()));
47 }
48 }
49 }
ButtonFrame.
1 // Fig. 26.16: ButtonTest.java
2 // Testing ButtonFrame.
3 import javax.swing.JFrame;
4
5 public class ButtonTest
6 {
7 public static void main(String[] args)
8 {
9 ButtonFrame buttonFrame = new ButtonFrame();
10 buttonFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
11 buttonFrame.setSize(275, 110);
12 buttonFrame.setVisible(true);
13 }
14 }

Lines 14–15 declare JButton variables plainJButton and fancyJButton. The corresponding objects are instantiated ...
Read now
Unlock full access