1 package rehaInternalFrame
;
2 import java
.awt
.Component
;
3 import java
.beans
.PropertyChangeEvent
;
4 import java
.beans
.PropertyChangeListener
;
5 import java
.beans
.PropertyVetoException
;
6 import java
.util
.ArrayList
;
7 import java
.util
.Iterator
;
10 import javax
.swing
.JDesktopPane
;
11 import javax
.swing
.JInternalFrame
;
14 * DISABLES THE MOVE METHODS, and iconifieys other OOOInternalFrames if maximized
16 public class OOOInternalFrame
extends JInternalFrame
{
21 private static final long serialVersionUID
= -142374973576893910L;
22 List
<OOOInternalFrame
> iconifiedOthers
= new ArrayList
<OOOInternalFrame
>();
24 public OOOInternalFrame() {
29 public OOOInternalFrame(String title
, boolean resizable
, boolean closable
, boolean maximizable
,
30 boolean iconifiable
) {
31 super(title
, resizable
, closable
, maximizable
, iconifiable
);
35 public OOOInternalFrame(String title
, boolean resizable
, boolean closable
, boolean maximizable
) {
36 super(title
, resizable
, closable
, maximizable
);
40 public OOOInternalFrame(String title
, boolean resizable
, boolean closable
) {
41 super(title
, resizable
, closable
);
45 public OOOInternalFrame(String title
, boolean resizable
) {
46 super(title
, resizable
);
50 public OOOInternalFrame(String title
) {
56 addPropertyChangeListener(new PropertyChangeListener() {
57 public void propertyChange(PropertyChangeEvent evt
) {
58 if (evt
.getPropertyName().equals(IS_MAXIMUM_PROPERTY
)) {
59 boolean newValue
= ((Boolean
) evt
.getNewValue()).booleanValue();
61 JDesktopPane desktop
= getDesktopPane();
62 Component
[] children
= desktop
.getComponents();
63 for (int i
= 0; i
< children
.length
; i
++) {
64 Component child
= children
[i
];
65 if (child
!= OOOInternalFrame
.this && child
instanceof OOOInternalFrame
) {
66 OOOInternalFrame oooInternalFrame
= (OOOInternalFrame
) child
;
67 if (!oooInternalFrame
.isIcon()) {
69 oooInternalFrame
.setIcon(true);
70 iconifiedOthers
.add(oooInternalFrame
);
72 catch (PropertyVetoException e
) {
79 else if (iconifiedOthers
.size() > 0) {
80 for (Iterator
<OOOInternalFrame
> iterator
= iconifiedOthers
.iterator(); iterator
.hasNext();) {
81 OOOInternalFrame oooInternalFrame
= iterator
.next();
83 oooInternalFrame
.setIcon(false);
85 catch (PropertyVetoException e
) {
89 iconifiedOthers
.clear();
96 public void moveToBack() {
97 //do nothing as this breaks the ooo window
100 public void moveToFront() {
101 //do nothing as this breaks the ooo window