KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jacorb > poa > gui > poa > StatePanel


1 package org.jacorb.poa.gui.poa;
2
3 /*
4  * JacORB - a free Java ORB
5  *
6  * Copyright (C) 1997-2004 Gerald Brose.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the Free
20  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  */

22  
23 import java.awt.Label JavaDoc;
24
25 /**
26  * @author Reimo Tiedemann, FU Berlin
27  * @version 1.0, 05/03/99, RT
28  */

29 public class StatePanel extends java.awt.Panel JavaDoc {
30     private java.awt.Label JavaDoc ivjNameLabel = null;
31     private java.awt.Label JavaDoc ivjValueLabel = null;
32 /**
33  * Return the NameLabel property value.
34  * @return java.awt.Label
35  */

36 /* WARNING: THIS METHOD WILL BE REGENERATED. */
37 private java.awt.Label JavaDoc getNameLabel() {
38     if (ivjNameLabel == null) {
39         try {
40             ivjNameLabel = new java.awt.Label JavaDoc();
41             ivjNameLabel.setName("NameLabel");
42             ivjNameLabel.setText("State:");
43             ivjNameLabel.setBounds(10, 10, 50, 23);
44             ivjNameLabel.setForeground(java.awt.Color.black);
45             // user code begin {1}
46
// user code end
47
} catch (java.lang.Throwable JavaDoc ivjExc) {
48             // user code begin {2}
49
// user code end
50
handleException(ivjExc);
51         }
52     };
53     return ivjNameLabel;
54 }
55 Label JavaDoc _getStateLabel() {
56     return getValueLabel();
57 }
58 /**
59  * Return the ValueLabel property value.
60  * @return java.awt.Label
61  */

62 /* WARNING: THIS METHOD WILL BE REGENERATED. */
63 private java.awt.Label JavaDoc getValueLabel() {
64     if (ivjValueLabel == null) {
65         try {
66             ivjValueLabel = new java.awt.Label JavaDoc();
67             ivjValueLabel.setName("ValueLabel");
68             ivjValueLabel.setFont(new java.awt.Font JavaDoc("dialog", 2, 12));
69             ivjValueLabel.setText("active");
70             ivjValueLabel.setBounds(60, 10, 230, 23);
71             // user code begin {1}
72
// user code end
73
} catch (java.lang.Throwable JavaDoc ivjExc) {
74             // user code begin {2}
75
// user code end
76
handleException(ivjExc);
77         }
78     };
79     return ivjValueLabel;
80 }
81 /**
82  * Called whenever the part throws an exception.
83  * @param exception java.lang.Throwable
84  */

85 private void handleException(Throwable JavaDoc exception) {
86
87     /* Uncomment the following lines to print uncaught exceptions to stdout */
88     // System.out.println("--------- UNCAUGHT EXCEPTION ---------");
89
// exception.printStackTrace(System.out);
90
}
91 /**
92  * Initialize the class.
93  */

94 /* WARNING: THIS METHOD WILL BE REGENERATED. */
95 private void initialize() {
96     // user code begin {1}
97
// user code end
98
setName("StatePanel");
99     setLayout(null);
100     setBackground(java.awt.SystemColor.control);
101     setSize(300, 43);
102     add(getNameLabel(), getNameLabel().getName());
103     add(getValueLabel(), getValueLabel().getName());
104     // user code begin {2}
105
// user code end
106
}
107 /**
108  * StatePanel constructor comment.
109  * @param layout java.awt.LayoutManager
110  */

111 public StatePanel(java.awt.LayoutManager JavaDoc layout) {
112     super(layout);
113 }
114 /**
115  * main entrypoint - starts the part when it is run as an application
116  * @param args java.lang.String[]
117  */

118 public static void main(java.lang.String JavaDoc[] args) {
119     try {
120         java.awt.Frame JavaDoc frame;
121         try {
122             Class JavaDoc aFrameClass = Class.forName("com.ibm.uvm.abt.edit.TestFrame");
123             frame = (java.awt.Frame JavaDoc)aFrameClass.newInstance();
124         } catch (java.lang.Throwable JavaDoc ivjExc) {
125             frame = new java.awt.Frame JavaDoc();
126         }
127         StatePanel aStatePanel;
128         aStatePanel = new StatePanel();
129         frame.add("Center", aStatePanel);
130         frame.setSize(aStatePanel.getSize());
131         frame.setVisible(true);
132     } catch (Throwable JavaDoc exception) {
133         System.err.println("Exception occurred in main() of java.awt.Panel");
134         exception.printStackTrace(System.out);
135     }
136 }
137 public void paint(java.awt.Graphics JavaDoc g) {
138     g.setColor(getBackground());
139     g.fill3DRect(0, 0, getBounds().width, getBounds().height, true);
140 }
141 /**
142  * Constructor
143  */

144 /* WARNING: THIS METHOD WILL BE REGENERATED. */
145 public StatePanel() {
146     super();
147     initialize();
148 }
149 }
150
151
152
153
154
155
156
157
158
159
160
161
162
Popular Tags