01: package com.vividsolutions.jump.workbench.ui;
02:
03: import java.awt.event.ActionEvent;
04: import java.awt.event.ActionListener;
05:
06: import java.util.Date;
07:
08: import javax.swing.JDesktopPane;
09: import javax.swing.JFrame;
10: import javax.swing.JInternalFrame;
11: import javax.swing.event.InternalFrameEvent;
12: import javax.swing.event.InternalFrameListener;
13:
14: import org.apache.log4j.Logger;
15:
16: public class InternalFrameTest {
17: private static Logger LOG = Logger
18: .getLogger(InternalFrameTest.class);
19:
20: public static InternalFrameListener listener = new InternalFrameListener() {
21: public void internalFrameOpened(InternalFrameEvent e) {
22: LOG
23: .debug(new Date()
24: + "public void internalFrameOpened(InternalFrameEvent e) {");
25: }
26:
27: public void internalFrameClosing(InternalFrameEvent e) {
28: LOG
29: .debug(new Date()
30: + "public void internalFrameClosing(InternalFrameEvent e) {");
31: }
32:
33: public void internalFrameClosed(InternalFrameEvent e) {
34: LOG
35: .debug(new Date()
36: + " public void internalFrameClosed(InternalFrameEvent e) {");
37: }
38:
39: public void internalFrameIconified(InternalFrameEvent e) {
40: LOG
41: .debug(new Date()
42: + "public void internalFrameIconified(InternalFrameEvent e) {");
43: }
44:
45: public void internalFrameDeiconified(InternalFrameEvent e) {
46: LOG
47: .debug(new Date()
48: + "public void internalFrameDeiconified(InternalFrameEvent e) {");
49: }
50:
51: public void internalFrameActivated(InternalFrameEvent e) {
52: LOG
53: .debug(new Date()
54: + "public void internalFrameActivated(InternalFrameEvent e) {");
55: }
56:
57: public void internalFrameDeactivated(InternalFrameEvent e) {
58: LOG
59: .debug(new Date()
60: + "public void internalFrameDeactivated(InternalFrameEvent e) {");
61: }
62: };
63:
64: public static void main(String[] args) {
65: JInternalFrame internalFrame = new JInternalFrame("Test", true,
66: true, true, true);
67: internalFrame.setSize(100, 100);
68:
69: JDesktopPane desktopPane = new JDesktopPane();
70: desktopPane.add(internalFrame);
71:
72: JFrame frame = new JFrame();
73: frame.setSize(400, 400);
74: frame.getContentPane().add(desktopPane);
75: frame.setVisible(true);
76: internalFrame.setVisible(true);
77:
78: //internalFrame.addInternalFrameListener(listener);
79:
80: GUIUtil.addInternalFrameListener(desktopPane, GUIUtil
81: .toInternalFrameListener(new ActionListener() {
82: public void actionPerformed(ActionEvent e) {
83: LOG.debug(new Date());
84: }
85: }));
86: }
87: }
|