1 19 20 package org.netbeans.modules.autoupdate; 21 22 23 import org.netbeans.api.options.OptionsDisplayer; 24 import org.openide.util.NbBundle; 25 26 class FirstPanel extends javax.swing.JPanel { 27 28 Wizard.Validator validator; 29 30 static final long serialVersionUID =-3335860872113235775L; 31 32 33 public FirstPanel( Wizard.Validator validator ) { 34 putClientProperty("WizardPanel_autoWizardStyle", Boolean.TRUE); putClientProperty("WizardPanel_contentDisplayed", Boolean.TRUE); putClientProperty("WizardPanel_contentNumbered", Boolean.TRUE); putClientProperty("WizardPanel_contentSelectedIndex", new Integer (0)); putClientProperty("WizardPanel_contentData", new String [] { getBundle("WIZ_First"), 40 getBundle("WIZ_Select"), 41 getBundle("WIZ_Download"), 42 getBundle("WIZ_View") 43 }); 44 setName(getBundle("LAB_First")); 45 initComponents (); 46 48 this.validator = validator; 49 50 jPanel1 = new ServerPanel(); 51 java.awt.GridBagConstraints gridBagConstraints1 = new java.awt.GridBagConstraints (); 52 gridBagConstraints1.gridx = 0; 53 gridBagConstraints1.gridy = 2; 54 gridBagConstraints1.gridheight = 5; 55 gridBagConstraints1.fill = java.awt.GridBagConstraints.BOTH; 56 gridBagConstraints1.insets = new java.awt.Insets (12, 36, 0, 36); 57 gridBagConstraints1.weighty = 1.0; 58 add(jPanel1, gridBagConstraints1); 59 60 getAccessibleContext().setAccessibleDescription(getBundle("ACS_FirstPanel")); 61 jRadioButton1.getAccessibleContext().setAccessibleDescription(getBundle("ACS_Radio1")); 62 jRadioButton2.getAccessibleContext().setAccessibleDescription(getBundle("ACS_Radio2_Top")); 63 proxyButton.getAccessibleContext().setAccessibleDescription(getBundle("ACS_Proxy")); 64 } 65 66 71 private void initComponents() { 73 java.awt.GridBagConstraints gridBagConstraints; 74 75 jRadioButton1 = new javax.swing.JRadioButton (); 76 nextLabel = new javax.swing.JLabel (); 77 jRadioButton2 = new javax.swing.JRadioButton (); 78 rb2Label1 = new javax.swing.JLabel (); 79 proxyButton = new javax.swing.JButton (); 80 81 FormListener formListener = new FormListener(); 82 83 setLayout(new java.awt.GridBagLayout ()); 84 85 jRadioButton1.setSelected(true); 86 org.openide.awt.Mnemonics.setLocalizedText(jRadioButton1, getBundle("CTL_Radio1")); 87 jRadioButton1.addActionListener(formListener); 88 89 gridBagConstraints = new java.awt.GridBagConstraints (); 90 gridBagConstraints.gridx = 0; 91 gridBagConstraints.gridy = 0; 92 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.RELATIVE; 93 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 94 add(jRadioButton1, gridBagConstraints); 95 96 org.openide.awt.Mnemonics.setLocalizedText(nextLabel, getBundle("LAB_Init")); 97 gridBagConstraints = new java.awt.GridBagConstraints (); 98 gridBagConstraints.gridx = 0; 99 gridBagConstraints.gridy = 8; 100 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 101 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 102 gridBagConstraints.weightx = 1.0; 103 gridBagConstraints.insets = new java.awt.Insets (12, 36, 0, 0); 104 add(nextLabel, gridBagConstraints); 105 106 org.openide.awt.Mnemonics.setLocalizedText(jRadioButton2, getBundle("CTL_Radio2_Top")); 107 buttonGroup=new javax.swing.ButtonGroup (); buttonGroup.add(jRadioButton1); buttonGroup.add(jRadioButton2); 108 jRadioButton2.addActionListener(formListener); 109 110 gridBagConstraints = new java.awt.GridBagConstraints (); 111 gridBagConstraints.gridx = 0; 112 gridBagConstraints.gridy = 9; 113 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 114 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 115 gridBagConstraints.insets = new java.awt.Insets (48, 0, 0, 0); 116 add(jRadioButton2, gridBagConstraints); 117 118 org.openide.awt.Mnemonics.setLocalizedText(rb2Label1, getBundle("CTL_Radio2_Bottom")); 119 gridBagConstraints = new java.awt.GridBagConstraints (); 120 gridBagConstraints.gridx = 0; 121 gridBagConstraints.gridy = 10; 122 gridBagConstraints.gridwidth = java.awt.GridBagConstraints.REMAINDER; 123 gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; 124 gridBagConstraints.weighty = 1.0; 125 gridBagConstraints.insets = new java.awt.Insets (0, 17, 0, 0); 126 add(rb2Label1, gridBagConstraints); 127 128 org.openide.awt.Mnemonics.setLocalizedText(proxyButton, getBundle("BNT_Proxy")); 129 proxyButton.addActionListener(formListener); 130 131 gridBagConstraints = new java.awt.GridBagConstraints (); 132 gridBagConstraints.gridx = 0; 133 gridBagConstraints.gridy = 7; 134 gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; 135 gridBagConstraints.insets = new java.awt.Insets (12, 36, 0, 0); 136 add(proxyButton, gridBagConstraints); 137 138 } 139 140 142 private class FormListener implements java.awt.event.ActionListener { 143 public void actionPerformed(java.awt.event.ActionEvent evt) { 144 if (evt.getSource() == jRadioButton1) { 145 FirstPanel.this.jRadioButton1ActionPerformed(evt); 146 } 147 else if (evt.getSource() == jRadioButton2) { 148 FirstPanel.this.jRadioButton2ActionPerformed(evt); 149 } 150 else if (evt.getSource() == proxyButton) { 151 FirstPanel.this.proxyButtonActionPerformed(evt); 152 } 153 } 154 } 156 private void proxyButtonActionPerformed(java.awt.event.ActionEvent evt) { OptionsDisplayer.getDefault ().open ("General"); 158 } 160 private void jRadioButton2ActionPerformed(java.awt.event.ActionEvent evt) { radioChange(); 162 } 164 private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent evt) { radioChange(); 166 } 168 169 private void radioChange(){ 170 if(jRadioButton1.isSelected()){ 171 proxyButton.setEnabled(true); 172 nextLabel.setEnabled(true); 173 jPanel1.setEnabled(true); 174 } 175 else{ 176 proxyButton.setEnabled(false); 177 nextLabel.setEnabled(false); 178 jPanel1.setEnabled(false); 179 } 180 validator.setValid( true ); 181 } 182 183 184 int getWizardType( ) { 185 if ( jRadioButton1.isSelected() ) 186 return 0; 187 188 else 189 return 1; 190 } 191 192 private static String getBundle( String key ) { 193 return NbBundle.getMessage( FirstPanel.class, key ); 194 } 195 196 private javax.swing.JRadioButton jRadioButton1; 198 private javax.swing.JRadioButton jRadioButton2; 199 private javax.swing.JLabel nextLabel; 200 private javax.swing.JButton proxyButton; 201 private javax.swing.JLabel rb2Label1; 202 private javax.swing.ButtonGroup buttonGroup; 204 private ServerPanel jPanel1; 205 206 } 207 | Popular Tags |