The Java Program: Application.java
1 import java.awt.event.WindowEvent;
2 import java.awt.event.WindowAdapter;
3 import java.awt.Window;
4
5 import javax.swing.JButton;
6 import javax.swing.JFrame;
7
8 public class Application {
9
10 public static void main (String [] args) {
11 // HTML text works for JLabel, JButton, JList, but not
12 // JToggleButton, JCheckBox, and JRadioButton.
13 // (No automatic underlying of the mnemonic character.)
14 final String ht = "<html><font size=+1 color=red>Click</font><br>here</html>";
15 final JButton cb = new JButton (ht);
16 final JFrame frame = new JFrame ("Application");
17 frame.getContentPane().add (cb);
18 frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); // Requires Java 1.3
19 frame.pack();
20 frame.setVisible (true);
21 }
22 }