KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openide > explorer > propertysheet > editors > MethodParameterPanel


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.openide.explorer.propertysheet.editors;
21
22 import java.util.ResourceBundle JavaDoc;
23 import java.awt.Dimension JavaDoc;
24 import java.util.Locale JavaDoc;
25
26 import org.openide.util.NbBundle;
27
28 /** Visual panel for editing one MethodParameter.
29  *
30  * @author Petr Hamernik
31  */

32 class MethodParameterPanel extends javax.swing.JPanel JavaDoc {
33     /** Resource bundle. */
34     static final ResourceBundle JavaDoc bundle = NbBundle.getBundle("org.openide.explorer.propertysheet.editors.Bundle2", Locale.getDefault(), MethodParameterPanel.class.getClassLoader()); // NOI18N
35

36     /** This array is used in type combo box. */
37     static final String JavaDoc[] COMMON_TYPES = {
38         "java.lang.String", // NOI18N
39
"java.lang.Object", // NOI18N
40
"boolean", // NOI18N
41
"byte", // NOI18N
42
"char", // NOI18N
43
"short", // NOI18N
44
"int", // NOI18N
45
"long", // NOI18N
46
"float", // NOI18N
47
"double" // NOI18N
48
};
49
50     static final long serialVersionUID =5505625069203018340L;
51     /** Creates new form ParamPanel */
52     public MethodParameterPanel() {
53         initComponents ();
54
55         typeLabel.setDisplayedMnemonic(bundle.getString("CTL_Type_Mnemonic").charAt(0));
56         nameLabel.setDisplayedMnemonic(bundle.getString("CTL_Name_Mnemonic").charAt(0));
57         finalCheckBox.setMnemonic(bundle.getString("CTL_Final_Mnemonic").charAt(0));
58
59         getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_MethodParameterPanel"));
60         typeLabel.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_Type"));
61         nameLabel.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_Name"));
62         finalCheckBox.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_Final"));
63     }
64
65     /** This method is called from within the constructor to
66      * initialize the form.
67      * WARNING: Do NOT modify this code. The content of this method is
68      * always regenerated by the FormEditor.
69      */

70     private void initComponents() {//GEN-BEGIN:initComponents
71
java.awt.GridBagConstraints JavaDoc gridBagConstraints;
72
73         typeLabel = new javax.swing.JLabel JavaDoc();
74         typeCombo = new javax.swing.JComboBox JavaDoc(COMMON_TYPES);
75         nameLabel = new javax.swing.JLabel JavaDoc();
76         nameTextField = new javax.swing.JTextField JavaDoc();
77         finalCheckBox = new javax.swing.JCheckBox JavaDoc();
78
79         setLayout(new java.awt.GridBagLayout JavaDoc());
80
81         setBorder(new javax.swing.border.EmptyBorder JavaDoc(new java.awt.Insets JavaDoc(12, 12, 0, 11)));
82         setMinimumSize(new java.awt.Dimension JavaDoc(500, 87));
83         typeLabel.setText(bundle.getString("CTL_Type"));
84         typeLabel.setLabelFor(typeCombo);
85         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
86         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
87         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 6, 8);
88         add(typeLabel, gridBagConstraints);
89
90         typeCombo.setEditable(true);
91         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
92         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
93         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
94         gridBagConstraints.weightx = 1.0;
95         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 6, 0);
96         add(typeCombo, gridBagConstraints);
97
98         nameLabel.setText(bundle.getString("CTL_Name"));
99         nameLabel.setLabelFor(nameTextField);
100         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
101         gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
102         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 6, 8);
103         add(nameLabel, gridBagConstraints);
104
105         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
106         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
107         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
108         gridBagConstraints.weightx = 1.0;
109         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 6, 0);
110         add(nameTextField, gridBagConstraints);
111
112         finalCheckBox.setText(bundle.getString("CTL_Final"));
113         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
114         gridBagConstraints.gridx = 1;
115         gridBagConstraints.gridy = 2;
116         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
117         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
118         gridBagConstraints.ipadx = 1;
119         gridBagConstraints.weightx = 1.0;
120         add(finalCheckBox, gridBagConstraints);
121
122     }//GEN-END:initComponents
123

124     public Dimension JavaDoc getPreferredSize() {
125         Dimension JavaDoc orig = super.getPreferredSize();
126         return new Dimension JavaDoc(orig.width + typeCombo.getPreferredSize().width, orig.height);
127     }
128
129     // Variables declaration - do not modify//GEN-BEGIN:variables
130
protected javax.swing.JLabel JavaDoc nameLabel;
131     protected javax.swing.JLabel JavaDoc typeLabel;
132     protected javax.swing.JCheckBox JavaDoc finalCheckBox;
133     protected javax.swing.JTextField JavaDoc nameTextField;
134     protected javax.swing.JComboBox JavaDoc typeCombo;
135     // End of variables declaration//GEN-END:variables
136

137 }
138
Popular Tags