KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > util > browser > core > panel > ParameterGUI


1 /*===========================================================================
2
3 ObjectWeb Naming Context Framework
4 Copyright (C) 2002 USTL - LIFL - GOAL
5 Contact: architecture@objectweb.org
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 USA
21
22 Initial developer(s): Jérôme Moroy.
23 Contributor(s): ______________________________________.
24
25 ===========================================================================*/

26
27 package org.objectweb.util.browser.core.panel;
28
29 /** The Java API's imports */
30 import javax.swing.JLabel JavaDoc;
31 import javax.swing.JTextField JavaDoc;
32 import java.awt.Dimension JavaDoc;
33 import javax.swing.BoxLayout JavaDoc;
34 import javax.swing.Box JavaDoc;
35
36 /**
37  * This class represents a Parameter
38  *
39  * @author <a HREF="mailto:Jerome.Moroy@lifl.fr">Jerome Moroy</a>
40  * @version 0.1
41  */

42 public class ParameterGUI extends Box JavaDoc {
43
44     protected Class JavaDoc class_;
45     protected JLabel JavaDoc label_;
46     protected JTextField JavaDoc value_;
47
48     public ParameterGUI(Class JavaDoc class_) {
49         super(BoxLayout.X_AXIS);
50         this.class_ = class_;
51         int lastIndex = class_.getName().lastIndexOf('.');
52         if (lastIndex != -1)
53             label_ = new JLabel JavaDoc(class_.getName().substring(lastIndex + 1));
54         else
55             label_ = new JLabel JavaDoc(class_.getName());
56         label_.setPreferredSize(new Dimension JavaDoc(100, 20));
57         add(label_);
58         value_ = new JTextField JavaDoc(15);
59         value_.setPreferredSize(new Dimension JavaDoc(330, 20));
60         add(value_);
61     }
62
63     public Class JavaDoc getParameterClass() {
64         return class_;
65     }
66
67     public String JavaDoc getParameterValue() {
68         return value_.getText();
69     }
70 }
71
Popular Tags