1 19 20 package org.netbeans.modules.java.ui.nodes.editors; 21 22 import java.util.ResourceBundle ; 23 import java.awt.Dimension ; 24 25 import org.openide.util.NbBundle; 26 27 31 class MethodParameterPanel extends javax.swing.JPanel { 32 33 static final ResourceBundle bundle = NbBundle.getBundle(MethodParameterPanel.class); 34 35 36 static final String [] COMMON_TYPES = TypeEditor.LVALUE_TYPES; 37 38 39 public MethodParameterPanel() { 40 initComponents (); 41 42 typeLabel.setDisplayedMnemonic(bundle.getString("CTL_Type_Mnemonic").charAt(0)); nameLabel.setDisplayedMnemonic(bundle.getString("CTL_Name_Mnemonic").charAt(0)); finalCheckBox.setMnemonic(bundle.getString("CTL_Final_Mnemonic").charAt(0)); 46 getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_MethodParameterPanel")); typeLabel.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_Type")); nameLabel.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_Name")); finalCheckBox.getAccessibleContext().setAccessibleDescription(bundle.getString("ACSD_Final")); } 51 52 57 private void initComponents() { 59 java.awt.GridBagConstraints gridBagConstraints; 60 61 typeLabel = new javax.swing.JLabel (); 62 typeCombo = new javax.swing.JComboBox (COMMON_TYPES); 63 nameLabel = new javax.swing.JLabel (); 64 nameTextField = new javax.swing.JTextField (); 65 finalCheckBox = new javax.swing.JCheckBox (); 66 67 setLayout(new java.awt.GridBagLayout ()); 68 69 setBorder(new javax.swing.border.EmptyBorder (new java.awt.Insets (12, 12, 0, 11))); 70 setMinimumSize(new java.awt.Dimension (500, 87)); 71 typeLabel.setText(bundle.getString("CTL_Type")); 72 typeLabel.setLabelFor(typeCombo); 73 gridBagConstraints = new java.awt.GridBagConstraints (); 74 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 75 gridBagConstraints.insets = new java.awt.Insets (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 (); 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 (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 (); 90 gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; 91 gridBagConstraints.insets = new java.awt.Insets (0, 0, 6, 8); 92 add(nameLabel, gridBagConstraints); 93 94 gridBagConstraints = new java.awt.GridBagConstraints (); 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 (0, 0, 6, 0); 99 add(nameTextField, gridBagConstraints); 100 101 finalCheckBox.setText(bundle.getString("CTL_Final")); 102 gridBagConstraints = new java.awt.GridBagConstraints (); 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 114 public Dimension getPreferredSize() { 115 Dimension orig = super.getPreferredSize(); 116 return new Dimension (orig.width + typeCombo.getPreferredSize().width, orig.height); 117 } 118 119 protected javax.swing.JLabel nameLabel; 121 protected javax.swing.JLabel typeLabel; 122 protected javax.swing.JCheckBox finalCheckBox; 123 protected javax.swing.JTextField nameTextField; 124 protected javax.swing.JComboBox typeCombo; 125 127 } 128 | Popular Tags |