01: package net.ar.webonswing.tutorial;
02:
03: import java.awt.*;
04: import java.awt.event.*;
05:
06: import javax.swing.*;
07:
08: import net.ar.webonswing.*;
09:
10: public class PartialUpdateTest1 extends JDialog {
11: private int counter = 0;
12:
13: public PartialUpdateTest1() {
14: JButton button = new JButton("open dialog");
15: button.addActionListener(new ActionListener() {
16: public void actionPerformed(ActionEvent e) {
17: PartialUpdateTest1 partialUpdateTest1 = new PartialUpdateTest1();
18: partialUpdateTest1.setModal(true);
19: WosFramework.showChildWindow(PartialUpdateTest1.this ,
20: partialUpdateTest1);
21: }
22: });
23:
24: final JButton countButton = new JButton(getCounterText());
25: countButton.addActionListener(new ActionListener() {
26: public void actionPerformed(ActionEvent e) {
27: counter++;
28: countButton.setText(getCounterText());
29: }
30: });
31:
32: final JButton closeButton = new JButton("close");
33: closeButton.addActionListener(new ActionListener() {
34: public void actionPerformed(ActionEvent e) {
35: WosFramework.hide(PartialUpdateTest1.this );
36: }
37: });
38:
39: getContentPane().add(button);
40: getContentPane().add(countButton);
41: getContentPane().add(closeButton);
42: getContentPane().setLayout(new GridLayout(3, 1));
43: Dimension dimension = new Dimension(100, 80);
44: getContentPane().setSize(dimension);
45: getRootPane().setSize(dimension);
46: }
47:
48: private String getCounterText() {
49: return "counter: " + counter;
50: }
51: }
|