1 19 20 package org.netbeans.modules.html.palette.items; 21 import java.awt.Dialog ; 22 import java.awt.event.ActionEvent ; 23 import java.awt.event.ActionListener ; 24 import org.openide.DialogDescriptor; 25 import org.openide.DialogDisplayer; 26 import org.openide.util.NbBundle; 27 28 29 30 31 35 public class FILESELCustomizer extends javax.swing.JPanel { 36 37 private Dialog dialog = null; 38 private DialogDescriptor descriptor = null; 39 private boolean dialogOK = false; 40 41 FILESEL filesel; 42 43 public FILESELCustomizer(FILESEL filesel) { 44 this.filesel = filesel; 45 46 initComponents(); 47 } 48 49 public boolean showDialog() { 50 51 dialogOK = false; 52 53 String displayName = ""; 54 try { 55 displayName = NbBundle.getBundle("org.netbeans.modules.html.palette.items.resources.Bundle").getString("NAME_html-FILESEL"); } 57 catch (Exception e) {} 58 59 descriptor = new DialogDescriptor 60 (this, NbBundle.getMessage(FILESELCustomizer.class, "LBL_Customizer_InsertPrefix") + " " + displayName, true, 61 DialogDescriptor.OK_CANCEL_OPTION, DialogDescriptor.OK_OPTION, 62 new ActionListener () { 63 public void actionPerformed(ActionEvent e) { 64 if (descriptor.getValue().equals(DialogDescriptor.OK_OPTION)) { 65 evaluateInput(); 66 dialogOK = true; 67 } 68 dialog.dispose(); 69 } 70 } 71 ); 72 73 dialog = DialogDisplayer.getDefault().createDialog(descriptor); 74 dialog.setVisible(true); 75 repaint(); 76 77 return dialogOK; 78 } 79 80 private void evaluateInput() { 81 82 String name = jTextField1.getText(); 83 filesel.setName(name); 84 85 String width = jTextField2.getText(); 86 filesel.setWidth(width); 87 88 filesel.setDisabled(jCheckBox1.isSelected()); 89 90 } 91 92 97 private void initComponents() { 99 java.awt.GridBagConstraints gridBagConstraints; 100 101 buttonGroup1 = new javax.swing.ButtonGroup (); 102 jTextField1 = new javax.swing.JTextField (); 103 jLabel1 = new javax.swing.JLabel (); 104 jLabel2 = new javax.swing.JLabel (); 105 jLabel3 = new javax.swing.JLabel (); 106 jCheckBox1 = new javax.swing.JCheckBox (); 107 jTextField2 = new javax.swing.JTextField (); 108 109 setLayout(new java.awt.GridBagLayout ()); 110 111 jTextField1.setColumns(30); 112 gridBagConstraints = new java.awt.GridBagConstraints (); 113 gridBagConstraints.gridx = 1; 114 gridBagConstraints.gridy = 0; 115 gridBagConstraints.gridwidth = 2; 116 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 117 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 118 gridBagConstraints.weightx = 1.0; 119 gridBagConstraints.insets = new java.awt.Insets (12, 12, 0, 12); 120 add(jTextField1, gridBagConstraints); 121 122 jLabel1.setLabelFor(jTextField1); 123 org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(FILESELCustomizer.class, "LBL_FILESEL_Name")); 124 gridBagConstraints = new java.awt.GridBagConstraints (); 125 gridBagConstraints.gridx = 0; 126 gridBagConstraints.gridy = 0; 127 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 128 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 129 gridBagConstraints.insets = new java.awt.Insets (12, 12, 0, 0); 130 add(jLabel1, gridBagConstraints); 131 jLabel1.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(FILESELCustomizer.class, "ACSN_FILESEL_Name")); 132 jLabel1.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(FILESELCustomizer.class, "ACSD_FILESEL_Name")); 133 134 jLabel2.setLabelFor(jTextField2); 135 org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(FILESELCustomizer.class, "LBL_FILESEL_Width")); 136 gridBagConstraints = new java.awt.GridBagConstraints (); 137 gridBagConstraints.gridx = 0; 138 gridBagConstraints.gridy = 1; 139 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 140 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 141 gridBagConstraints.insets = new java.awt.Insets (12, 12, 0, 0); 142 add(jLabel2, gridBagConstraints); 143 jLabel2.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(FILESELCustomizer.class, "ACSN_FILESEL_Width")); 144 jLabel2.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(FILESELCustomizer.class, "ACSD_FILESEL_Width")); 145 146 org.openide.awt.Mnemonics.setLocalizedText(jLabel3, org.openide.util.NbBundle.getMessage(FILESELCustomizer.class, "LBL_FILESEL_InitState")); 147 gridBagConstraints = new java.awt.GridBagConstraints (); 148 gridBagConstraints.gridx = 0; 149 gridBagConstraints.gridy = 2; 150 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 151 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 152 gridBagConstraints.insets = new java.awt.Insets (12, 12, 12, 0); 153 add(jLabel3, gridBagConstraints); 154 jLabel3.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(FILESELCustomizer.class, "ACSN_FILESEL_InitState")); 155 jLabel3.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(FILESELCustomizer.class, "ACSD_FILESEL_InitState")); 156 157 org.openide.awt.Mnemonics.setLocalizedText(jCheckBox1, org.openide.util.NbBundle.getMessage(FILESELCustomizer.class, "LBL_FILESEL_disabled")); 158 jCheckBox1.setBorder(new javax.swing.border.EmptyBorder (new java.awt.Insets (0, 0, 0, 0))); 159 jCheckBox1.setMargin(new java.awt.Insets (0, 0, 0, 0)); 160 gridBagConstraints = new java.awt.GridBagConstraints (); 161 gridBagConstraints.gridx = 1; 162 gridBagConstraints.gridy = 2; 163 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 164 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 165 gridBagConstraints.weighty = 1.0; 166 gridBagConstraints.insets = new java.awt.Insets (12, 12, 12, 12); 167 add(jCheckBox1, gridBagConstraints); 168 jCheckBox1.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(FILESELCustomizer.class, "ACSN_FILESEL_disabled")); 169 jCheckBox1.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(FILESELCustomizer.class, "ACSD_FILESEL_disabled")); 170 171 gridBagConstraints = new java.awt.GridBagConstraints (); 172 gridBagConstraints.gridx = 1; 173 gridBagConstraints.gridy = 1; 174 gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; 175 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 176 gridBagConstraints.insets = new java.awt.Insets (12, 12, 0, 12); 177 add(jTextField2, gridBagConstraints); 178 179 } 180 182 183 private javax.swing.ButtonGroup buttonGroup1; 185 private javax.swing.JCheckBox jCheckBox1; 186 private javax.swing.JLabel jLabel1; 187 private javax.swing.JLabel jLabel2; 188 private javax.swing.JLabel jLabel3; 189 private javax.swing.JTextField jTextField1; 190 private javax.swing.JTextField jTextField2; 191 193 } 194 | Popular Tags |