1 19 20 package org.netbeans.modules.javawebstart; 21 22 import java.awt.event.ActionEvent ; 23 import java.awt.event.ActionListener ; 24 25 import java.util.HashMap ; 26 import java.util.Map ; 27 28 import org.netbeans.modules.java.j2seproject.api.J2SERunConfigProvider; 29 30 34 public class CustomizerRunComponent extends javax.swing.JPanel implements ActionListener { 35 36 private Map <String ,String > runSelectedMap = new HashMap <String ,String >(); 37 private Map <String ,String > runUnselectedMap = new HashMap <String ,String >(); 38 39 private J2SERunConfigProvider.ConfigChangeListener listener; 40 41 public CustomizerRunComponent() { 42 initComponents(); 43 runCheckBox.addActionListener(this); 44 } 45 46 51 private void initComponents() { 53 java.awt.GridBagConstraints gridBagConstraints; 54 55 runCheckBox = new javax.swing.JCheckBox (); 56 hintLabel = new javax.swing.JLabel (); 57 58 setLayout(new java.awt.GridBagLayout ()); 59 60 runCheckBox.setText(org.openide.util.NbBundle.getMessage(CustomizerRunComponent.class, "LBL_Run_with_JWS")); runCheckBox.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0)); 62 runCheckBox.setMargin(new java.awt.Insets (0, 0, 0, 0)); 63 gridBagConstraints = new java.awt.GridBagConstraints (); 64 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 65 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 66 add(runCheckBox, gridBagConstraints); 67 68 hintLabel.setText(org.openide.util.NbBundle.getMessage(CustomizerRunComponent.class, "HINT_Run_with_JWS")); gridBagConstraints = new java.awt.GridBagConstraints (); 70 gridBagConstraints.gridx = 0; 71 gridBagConstraints.gridy = 1; 72 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 73 gridBagConstraints.gridheight = java.awt.GridBagConstraints.REMAINDER; 74 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 75 gridBagConstraints.insets = new java.awt.Insets (4, 22, 0, 0); 76 add(hintLabel, gridBagConstraints); 77 } 79 public void addListener(J2SERunConfigProvider.ConfigChangeListener l) { 80 listener = l; 81 } 82 83 public void setCheckboxEnabled(boolean b) { 84 runCheckBox.setEnabled(b); 85 } 86 87 public void setCheckboxSelected(boolean b) { 88 runCheckBox.setSelected(b); 89 } 90 91 public void setHintVisible(boolean b) { 92 hintLabel.setVisible(b); 93 } 94 95 public void actionPerformed(ActionEvent e) { 96 initMaps(); 97 if (runCheckBox.isSelected()) { 98 listener.propertiesChanged(runSelectedMap); 99 } else { 100 listener.propertiesChanged(runUnselectedMap); 101 } 102 } 103 104 private void initMaps() { 105 runUnselectedMap.put("$target.run", null); 106 runUnselectedMap.put("$target.debug", null); 107 runSelectedMap.put("$target.run", "jws-run"); 108 runSelectedMap.put("$target.debug", "jws-debug"); 109 } 110 111 private javax.swing.JLabel hintLabel; 113 private javax.swing.JCheckBox runCheckBox; 114 116 } 117 | Popular Tags |