/Users/lyon/j4p/src/bookExamples/ch18Swing/awt/DialogExample.java
|
1 /*
2 * Created by DocJava, Inc.
3 * User: lyon
4 * Date: Apr 26, 2003
5 * Time: 7:25:34 AM
6 */
7 package bookExamples.ch18Swing.awt;
8
9 import gui.run.RunButton;
10
11 import javax.swing.*;
12 import java.awt.*;
13
14
15 public class DialogExample {
16
17
18 public static void getDialog(boolean modal) {
19
20
21 JDialog jd = new JDialog(new JFrame(),
22 "A dialog", modal);
23 Container c = jd.getContentPane();
24 c.setLayout(new BorderLayout());
25 JPanel jp = new JPanel();
26 jp.setLayout(new FlowLayout());
27 jp.add(new RunButton("ok") {
28 public void run() {
29 System.out.println("ok");
30 }
31 });
32 jp.add(new RunButton("cancel") {
33 public void run() {
34 System.out.println("cancel");
35 }
36 });
37 c.add(jp);
38 jd.setSize(200, 200);
39 jd.show();
40
41 }
42
43
44 public static void main(String[] args) {
45
46 getDialog(true);
47 }
48 }
49