1 19 20 package org.openide.explorer.propertysheet.editors; 21 22 import java.util.ResourceBundle ; 23 import java.awt.Dimension ; 24 import java.util.Locale ; 25 26 import org.openide.util.NbBundle; 27 28 32 class MethodParameterPanel extends javax.swing.JPanel { 33 34 static final ResourceBundle bundle = NbBundle.getBundle("org.openide.explorer.propertysheet.editors.Bundle2", Locale.getDefault(), MethodParameterPanel.class.getClassLoader()); 36 37 static final String [] COMMON_TYPES = { 38 "java.lang.String", "java.lang.Object", "boolean", "byte", "char", "short", "int", "long", "float", "double" }; 49 50 static final long serialVersionUID =5505625069203018340L; 51 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 70 private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; 72 73 typeLabel = new javax.swing.JLabel (); 74 typeCombo = new javax.swing.JComboBox (COMMON_TYPES); 75 nameLabel = new javax.swing.JLabel (); 76 nameTextField = new javax.swing.JTextField (); 77 finalCheckBox = new javax.swing.JCheckBox (); 78 79 setLayout(new java.awt.GridBagLayout ()); 80 81 setBorder(new javax.swing.border.EmptyBorder (new java.awt.Insets (12, 12, 0, 11))); 82 setMinimumSize(new java.awt.Dimension (500, 87)); 83 typeLabel.setText(bundle.getString("CTL_Type")); 84 typeLabel.setLabelFor(typeCombo); 85 gridBagConstraints = new java.awt.GridBagConstraints (); 86 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 87 gridBagConstraints.insets = new java.awt.Insets (0, 0, 6, 8); 88 add(typeLabel, gridBagConstraints); 89 90 typeCombo.setEditable(true); 91 gridBagConstraints = new java.awt.GridBagConstraints (); 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 (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 (); 101 gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; 102 gridBagConstraints.insets = new java.awt.Insets (0, 0, 6, 8); 103 add(nameLabel, gridBagConstraints); 104 105 gridBagConstraints = new java.awt.GridBagConstraints (); 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 (0, 0, 6, 0); 110 add(nameTextField, gridBagConstraints); 111 112 finalCheckBox.setText(bundle.getString("CTL_Final")); 113 gridBagConstraints = new java.awt.GridBagConstraints (); 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 } 124 public Dimension getPreferredSize() { 125 Dimension orig = super.getPreferredSize(); 126 return new Dimension (orig.width + typeCombo.getPreferredSize().width, orig.height); 127 } 128 129 protected javax.swing.JLabel nameLabel; 131 protected javax.swing.JLabel typeLabel; 132 protected javax.swing.JCheckBox finalCheckBox; 133 protected javax.swing.JTextField nameTextField; 134 protected javax.swing.JComboBox typeCombo; 135 137 } 138 | Popular Tags |