1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package net.sf.magicproject.tools;
20
21 import java.awt.event.ActionEvent;
22 import java.awt.event.ActionListener;
23
24 import javax.swing.JComponent;
25
26 /***
27 * Bring to front manager
28 *
29 * @author <a href="mailto:fabdouglas@users.sourceforge.net">Fabrice Daugan </a>
30 * @since 0.84
31 */
32 public class BringToFrontListener implements ActionListener {
33
34 public void actionPerformed(ActionEvent e) {
35
36 }
37
38 /***
39 * Set the bring to front component. This restore the previous bring to front
40 * component state, then bring this component to front. Bringing to front
41 * simply repaint a component.
42 *
43 * @param component
44 */
45 public void setBringToFrontComponent(JComponent component) {
46
47 if (this.component != null) {
48 this.component.getParent().repaint();
49 }
50 this.component = component;
51 this.component.getParent().repaint();
52
53 }
54
55 /***
56 * Return the current bring to front component. If none, retur null.
57 *
58 * @return the current bring to front component. If none, retur null.
59 */
60 public JComponent getBringToFrontComponent() {
61 return component;
62 }
63
64 /***
65 * Indicates the specified component is the bring to front one.
66 *
67 * @param component
68 * the tested component.
69 * @return true if the specified component is the bring to front one.
70 */
71 public boolean isBringToFront(JComponent component) {
72 return this.component == component;
73 }
74
75 /***
76 * The last bring to front component.
77 */
78 private JComponent component;
79
80 }