KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > java > ui > nodes > 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.netbeans.modules.java.ui.nodes.editors;
21
22 import java.util.ResourceBundle JavaDoc;
23 import java.awt.Dimension JavaDoc;
24
25 import org.openide.util.NbBundle;
26
27 /** Visual panel for editing one MethodParameter.
28  *
29  * @author Petr Hamernik
30  */

31 class MethodParameterPanel extends javax.swing.JPanel JavaDoc {
32     /** Resource bundle. */
33     static final ResourceBundle JavaDoc bundle = NbBundle.getBundle(MethodParameterPanel.class);
34
35     /** This array is used in type combo box. */
36     static final String JavaDoc[] COMMON_TYPES = TypeEditor.LVALUE_TYPES;
37
38     /** Creates new form ParamPanel */
39     public MethodParameterPanel() {
40         initComponents ();
41
42         typeLabel.setDisplayedMnemonic(bundle.getString("CTL_Type_Mnemonic").charAt(0)); // NOI18N
43
nameLabel.setDisplayedMnemonic(bundle.getString("CTL_Name_Mnemonic").charAt(0)); // NOI18N
44
finalCheckBox.setMnemonic(bundle.getString("CTL_Final_Mnemonic").charAt(0)); // NOI18N
45

46         getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_MethodParameterPanel")); // NOI18N
47
typeLabel.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_Type")); // NOI18N
48
nameLabel.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_Name")); // NOI18N
49
finalCheckBox.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_Final")); // NOI18N
50
}
51
52     /** This method is called from within the constructor to
53      * initialize the form.
54      * WARNING: Do NOT modify this code. The content of this method is
55      * always regenerated by the FormEditor.
56      */

57     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
58
private void initComponents() {
59         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
60
61         typeLabel = new javax.swing.JLabel JavaDoc();
62         typeCombo = new javax.swing.JComboBox JavaDoc(COMMON_TYPES);
63         nameLabel = new javax.swing.JLabel JavaDoc();
64         nameTextField = new javax.swing.JTextField JavaDoc();
65         finalCheckBox = new javax.swing.JCheckBox JavaDoc();
66
67         setLayout(new java.awt.GridBagLayout JavaDoc());
68
69         setBorder(new javax.swing.border.EmptyBorder JavaDoc(new java.awt.Insets JavaDoc(12, 12, 0, 11)));
70         setMinimumSize(new java.awt.Dimension JavaDoc(500, 87));
71         typeLabel.setText(bundle.getString("CTL_Type"));
72         typeLabel.setLabelFor(typeCombo);
73         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
74         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
75         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 6, 8);
76         add(typeLabel, gridBagConstraints);
77
78         typeCombo.setEditable(true);
79         typeCombo.setSelectedItem(TypeEditor.LVALUE_TYPES[TypeEditor.LVALUE_TYPES.length-1]);
80         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
81         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
82         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
83         gridBagConstraints.weightx = 1.0;
84         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 6, 0);
85         add(typeCombo, gridBagConstraints);
86
87         nameLabel.setText(bundle.getString("CTL_Name"));
88         nameLabel.setLabelFor(nameTextField);
89         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
90         gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
91         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 6, 8);
92         add(nameLabel, gridBagConstraints);
93
94         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
95         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
96         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
97         gridBagConstraints.weightx = 1.0;
98         gridBagConstraints.insets = new java.awt.Insets JavaDoc(0, 0, 6, 0);
99         add(nameTextField, gridBagConstraints);
100
101         finalCheckBox.setText(bundle.getString("CTL_Final"));
102         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
103         gridBagConstraints.gridx = 1;
104         gridBagConstraints.gridy = 2;
105         gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER;
106         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
107         gridBagConstraints.ipadx = 1;
108         gridBagConstraints.weightx = 1.0;
109         add(finalCheckBox, gridBagConstraints);
110
111     }
112     // </editor-fold>//GEN-END:initComponents
113

114     public Dimension JavaDoc getPreferredSize() {
115         Dimension JavaDoc orig = super.getPreferredSize();
116         return new Dimension JavaDoc(orig.width + typeCombo.getPreferredSize().width, orig.height);
117     }
118
119     // Variables declaration - do not modify//GEN-BEGIN:variables
120
protected javax.swing.JLabel JavaDoc nameLabel;
121     protected javax.swing.JLabel JavaDoc typeLabel;
122     protected javax.swing.JCheckBox JavaDoc finalCheckBox;
123     protected javax.swing.JTextField JavaDoc nameTextField;
124     protected javax.swing.JComboBox JavaDoc typeCombo;
125     // End of variables declaration//GEN-END:variables
126

127 }
128
Popular Tags