/Users/lyon/j4p/src/gui/run/examples/MultiCompExample.java
|
1 /**
2 * Created by IntelliJ IDEA.
3 * User: dlyon
4 * Date: Mar 1, 2004
5 * Time: 4:08:39 PM
6 * To change this template use Options | File Templates.
7 */
8 package gui.run.examples;
9
10 import gui.run.RunButton;
11 import gui.run.RunMenu;
12 import gui.run.RunMenuItem;
13
14 import javax.swing.*;
15 import java.awt.*;
16
17 public class MultiCompExample {
18 public static void main(String args[]) {
19
20
21 gui.ClosableJFrame cf =
22 new gui.ClosableJFrame("Wake up!");
23 Container c = cf.getContentPane();
24 c.setLayout(new FlowLayout());
25 RunMenu fileMenu = new RunMenu("[File");
26 JMenuBar mb = new JMenuBar();
27 fileMenu.add(new openMenuItem());
28 mb.add(fileMenu);
29 cf.setJMenuBar(mb);
30 for (int i = 0; i < 100; i++) {
31 c.add(new RunButton("ok[" + (char)i) {
32 public void run() {
33 System.out.println(getText());
34 }
35 });
36 }
37 cf.setSize(200, 200);
38 cf.show();
39 }
40
41 private static class openMenuItem extends RunMenuItem {
42 public openMenuItem() {
43 super("[open{ctrl O}");
44 }
45
46 public void run() {
47 System.out.println(getText());
48 }
49 }
50 }
51