KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > autoupdate > FirstPanel


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

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 JavaDoc {
27
28     Wizard.Validator validator;
29
30     static final long serialVersionUID =-3335860872113235775L;
31
32     /** Creates new form FirstPanel */
33     public FirstPanel( Wizard.Validator validator ) {
34         putClientProperty("WizardPanel_autoWizardStyle", Boolean.TRUE); // NOI18N
35
putClientProperty("WizardPanel_contentDisplayed", Boolean.TRUE); // NOI18N
36
putClientProperty("WizardPanel_contentNumbered", Boolean.TRUE); // NOI18N
37
putClientProperty("WizardPanel_contentSelectedIndex", new Integer JavaDoc(0)); // NOI18N
38
putClientProperty("WizardPanel_contentData", new String JavaDoc[] { // NOI18N
39
getBundle("WIZ_First"),
40             getBundle("WIZ_Select"),
41             getBundle("WIZ_Download"),
42             getBundle("WIZ_View")
43         });
44         setName(getBundle("LAB_First"));
45         initComponents ();
46 // setPreferredSize(new java.awt.Dimension(500, 380));
47

48         this.validator = validator;
49         
50         jPanel1 = new ServerPanel();
51         java.awt.GridBagConstraints JavaDoc gridBagConstraints1 = new java.awt.GridBagConstraints JavaDoc();
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 JavaDoc(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     /** This method is called from within the constructor to
67      * initialize the form.
68      * WARNING: Do NOT modify this code. The content of this method is
69      * always regenerated by the FormEditor.
70      */

71     // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
72
private void initComponents() {
73         java.awt.GridBagConstraints JavaDoc gridBagConstraints;
74
75         jRadioButton1 = new javax.swing.JRadioButton JavaDoc();
76         nextLabel = new javax.swing.JLabel JavaDoc();
77         jRadioButton2 = new javax.swing.JRadioButton JavaDoc();
78         rb2Label1 = new javax.swing.JLabel JavaDoc();
79         proxyButton = new javax.swing.JButton JavaDoc();
80
81         FormListener formListener = new FormListener();
82
83         setLayout(new java.awt.GridBagLayout JavaDoc());
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 JavaDoc();
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 JavaDoc();
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 JavaDoc(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 JavaDoc(); buttonGroup.add(jRadioButton1); buttonGroup.add(jRadioButton2);
108         jRadioButton2.addActionListener(formListener);
109
110         gridBagConstraints = new java.awt.GridBagConstraints JavaDoc();
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 JavaDoc(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 JavaDoc();
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 JavaDoc(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 JavaDoc();
132         gridBagConstraints.gridx = 0;
133         gridBagConstraints.gridy = 7;
134         gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
135         gridBagConstraints.insets = new java.awt.Insets JavaDoc(12, 36, 0, 0);
136         add(proxyButton, gridBagConstraints);
137
138     }
139
140     // Code for dispatching events from components to event handlers.
141

142     private class FormListener implements java.awt.event.ActionListener JavaDoc {
143         public void actionPerformed(java.awt.event.ActionEvent JavaDoc 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     }// </editor-fold>//GEN-END:initComponents
155

156     private void proxyButtonActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_proxyButtonActionPerformed
157
OptionsDisplayer.getDefault ().open ("General");
158     }//GEN-LAST:event_proxyButtonActionPerformed
159

160     private void jRadioButton2ActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_jRadioButton2ActionPerformed
161
radioChange();
162     }//GEN-LAST:event_jRadioButton2ActionPerformed
163

164   private void jRadioButton1ActionPerformed(java.awt.event.ActionEvent JavaDoc evt) {//GEN-FIRST:event_jRadioButton1ActionPerformed
165
radioChange();
166   }//GEN-LAST:event_jRadioButton1ActionPerformed
167

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     /** Returns the type of wizard the user selected */
184     int getWizardType( ) {
185         if ( jRadioButton1.isSelected() )
186             return 0;
187        
188         else
189             return 1;
190     }
191   
192     private static String JavaDoc getBundle( String JavaDoc key ) {
193         return NbBundle.getMessage( FirstPanel.class, key );
194     }
195     
196     // Variables declaration - do not modify//GEN-BEGIN:variables
197
private javax.swing.JRadioButton JavaDoc jRadioButton1;
198     private javax.swing.JRadioButton JavaDoc jRadioButton2;
199     private javax.swing.JLabel JavaDoc nextLabel;
200     private javax.swing.JButton JavaDoc proxyButton;
201     private javax.swing.JLabel JavaDoc rb2Label1;
202     // End of variables declaration//GEN-END:variables
203
private javax.swing.ButtonGroup JavaDoc buttonGroup;
204     private ServerPanel jPanel1;
205
206 }
207
Popular Tags