Last change
on this file since 356 was
355,
checked in by sherbold, 13 years ago
|
- Extended functionality of the JFCMonitor. It now monitors the whole hierarchy of the created GUI and uses this information to improve the precision in the usage logs.
|
-
Property svn:mime-type set to
text/plain
|
File size:
1.0 KB
|
Line | |
---|
1 | package de.ugoe.cs.eventbench.jfcmonitor;
|
---|
2 |
|
---|
3 | import java.awt.AWTEvent;
|
---|
4 | import java.awt.Window;
|
---|
5 | import java.awt.event.AWTEventListener;
|
---|
6 | import java.awt.event.WindowEvent;
|
---|
7 |
|
---|
8 | /**
|
---|
9 | * <p>
|
---|
10 | * An AWT event listener responsible to monitor the window creation and
|
---|
11 | * destruction.
|
---|
12 | * </p>
|
---|
13 | *
|
---|
14 | * @author Steffen Herbold
|
---|
15 | * @version 1.0
|
---|
16 | */
|
---|
17 | public class WindowMonitor implements AWTEventListener {
|
---|
18 |
|
---|
19 | /**
|
---|
20 | * <p>
|
---|
21 | * Adds all created windows (and their child components) to the GUI
|
---|
22 | * hierarchy maintained by {@link JFCComponent} and removes them if a window
|
---|
23 | * is destroyed.
|
---|
24 | * </p>
|
---|
25 | * </p>
|
---|
26 | *
|
---|
27 | * @see java.awt.event.AWTEventListener#eventDispatched(java.awt.AWTEvent)
|
---|
28 | */
|
---|
29 | @Override
|
---|
30 | public void eventDispatched(AWTEvent event) {
|
---|
31 | Window window;
|
---|
32 | switch (event.getID()) {
|
---|
33 | case WindowEvent.WINDOW_OPENED:
|
---|
34 | window = ((WindowEvent) event).getWindow();
|
---|
35 | JFCComponent.add(window);
|
---|
36 | break;
|
---|
37 | case WindowEvent.WINDOW_CLOSED:
|
---|
38 | window = ((WindowEvent) event).getWindow();
|
---|
39 | JFCComponent.remove(window);
|
---|
40 | break;
|
---|
41 | }
|
---|
42 | }
|
---|
43 |
|
---|
44 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.