KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tc > admin > common > XFrame


1 /*
2  * All content copyright (c) 2003-2006 Terracotta, Inc., except as may otherwise be noted in a separate copyright notice. All rights reserved.
3  */

4 package com.tc.admin.common;
5
6 import java.awt.event.ActionEvent JavaDoc;
7 import java.awt.event.ActionListener JavaDoc;
8 import java.awt.event.ComponentAdapter JavaDoc;
9 import java.awt.event.ComponentEvent JavaDoc;
10
11 import javax.swing.Timer JavaDoc;
12
13 import org.dijon.Frame;
14
15 public class XFrame extends Frame {
16   private Timer JavaDoc storeTimer;
17
18   public XFrame() {
19     super();
20
21     storeTimer = new Timer JavaDoc(1000, new ActionListener JavaDoc() {
22       public void actionPerformed(ActionEvent JavaDoc e) {
23         storeBounds();
24       }
25     });
26     storeTimer.setRepeats(false);
27
28     addComponentListener(new ComponentListener());
29   }
30
31   public void storeBounds() {/**/}
32
33   class ComponentListener extends ComponentAdapter JavaDoc {
34     public void componentResized(ComponentEvent JavaDoc e) {
35       if(storeTimer.isRunning()) {
36         storeTimer.stop();
37       }
38       storeTimer.start();
39     }
40     public void componentMoved(ComponentEvent JavaDoc e) {
41       if(storeTimer.isRunning()) {
42         storeTimer.stop();
43       }
44       storeTimer.start();
45     }
46   }
47 }
48
Popular Tags