blob: b03c3b9e8e372fff99898a6173a0073694726aad (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
package Utilities ;
import java.awt.*;
import java.applet.* ;
import java.awt.event.*;
import javax.swing.*;
//==============================================================================
/**
*
* <b>Container object with JApplet, JFrame, and JDialog properties.<p></b>
*
*/
//==============================================================================
public class SuperContainer{
Container InputContainer ;
JRootPane RP ;
Frame SuperFrame ; // Frame of overall screen.
boolean IsJApplet = false ;
boolean IsJFrame = false ;
boolean IsJDialog = false ;
boolean IsWindow = false ;
/**
* Container object with JApplet, JFrame, and JDialog properties.
*
* @param InputContainer Container, either a JApplet, JFrame, or JDialog.
*/
public SuperContainer(Container InputContainer){
this.InputContainer = InputContainer ;
if(InputContainer instanceof JApplet){
IsJApplet = true ;
RP = ((JApplet) InputContainer).getRootPane() ;
}
else if(InputContainer instanceof JFrame){
IsJFrame = true ;
RP = ((JFrame) InputContainer).getRootPane() ;
}
else if(InputContainer instanceof JDialog){
RP = ((JDialog) InputContainer).getRootPane() ;
IsJDialog = true ;
}
else{
System.out.println("SuperContainer: Bad input type!") ;
}
IsWindow = IsJFrame | IsJDialog ;
SuperFrame = GetParentFrame.GetParentFrame(RP.getContentPane()) ;
}
//------------------------------------------------------------------------------
public Container getContentPane(){
return RP.getContentPane() ;
}
//------------------------------------------------------------------------------
public boolean isApplet(){
return IsJApplet ;
}
//------------------------------------------------------------------------------
public boolean isWindow(){
return IsWindow ;
}
//------------------------------------------------------------------------------
public void setResizable(boolean Resizable) {
if(IsJDialog){
((Dialog)InputContainer).setResizable(Resizable) ;
}
else{
SuperFrame.setResizable(Resizable) ;
}
}
//------------------------------------------------------------------------------
public void setTitle(String Title) {
if(IsJFrame){
((JFrame) InputContainer).setTitle(Title);
}
else if(IsJDialog){
((JDialog) InputContainer).setTitle(Title);
}
return ;
}
//------------------------------------------------------------------------------
public void addWindowListener(WindowListener WL) {
if (IsWindow){
((Window)InputContainer).addWindowListener(WL) ;
}
return ;
}
//------------------------------------------------------------------------------
public void setLocation( Point P ) {
if (IsWindow){
((Window)InputContainer).setLocation(P) ;
}
return ;
}
//------------------------------------------------------------------------------
public void setSize( Dimension D ) {
if (IsWindow){
((Window)InputContainer).setSize(D) ;
}
return ;
}
//------------------------------------------------------------------------------
public void setVisible(boolean Visible) {
((Component)InputContainer).setVisible(Visible) ;
return ;
}
//------------------------------------------------------------------------------
public void dispose() {
if (IsWindow){
((Window)InputContainer).dispose() ;
}
else{
// Restart ?
}
return ;
}
//------------------------------------------------------------------------------
public Point getLocation() {
if (IsWindow){
return ((Window)InputContainer).getLocation() ;
}
else{
return null ;
}
}
//------------------------------------------------------------------------------
public void pack() {
if (IsWindow){
((Window)InputContainer).pack() ;
}
return ;
}
//------------------------------------------------------------------------------
public Dimension getSize() {
if (IsWindow){
return ((Window)InputContainer).getSize() ;
}
else{
return null ;
}
}
//------------------------------------------------------------------------------
public void setIconImage(Image I) {
if (IsWindow){
SuperFrame.setIconImage(I) ;
}
}
//------------------------------------------------------------------------------
public Frame superFrame() {
return SuperFrame ;
}
//------------------------------------------------------------------------------
public void showStatus(String Status) {
if (!IsWindow){
((Applet)InputContainer).getAppletContext().showStatus(Status) ;
}
}
//------------------------------------------------------------------------------
public Component getGlassPane() {
return RP.getGlassPane() ;
}
//------------------------------------------------------------------------------
public void setGlassPane(Component GP) {
RP.setGlassPane(GP) ;
}
//------------------------------------------------------------------------------
public JRootPane getRootPane() {
return RP.getRootPane() ;
}
//------------------------------------------------------------------------------
public void addMouseListener(MouseListener ML) {
RP.addMouseListener(ML);
}
//------------------------------------------------------------------------------
}
//==============================================================================
|