Added
Link Here
|
1 |
/* |
2 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
3 |
* |
4 |
* Copyright 2009 Sun Microsystems, Inc. All rights reserved. |
5 |
* |
6 |
* The contents of this file are subject to the terms of either the GNU |
7 |
* General Public License Version 2 only ("GPL") or the Common |
8 |
* Development and Distribution License("CDDL") (collectively, the |
9 |
* "License"). You may not use this file except in compliance with the |
10 |
* License. You can obtain a copy of the License at |
11 |
* http://www.netbeans.org/cddl-gplv2.html |
12 |
* or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the |
13 |
* specific language governing permissions and limitations under the |
14 |
* License. When distributing the software, include this License Header |
15 |
* Notice in each file and include the License file at |
16 |
* nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this |
17 |
* particular file as subject to the "Classpath" exception as provided |
18 |
* by Sun in the GPL Version 2 section of the License file that |
19 |
* accompanied this code. If applicable, add the following below the |
20 |
* License Header, with the fields enclosed by brackets [] replaced by |
21 |
* your own identifying information: |
22 |
* "Portions Copyrighted [year] [name of copyright owner]" |
23 |
* |
24 |
* If you wish your version of this file to be governed by only the CDDL |
25 |
* or only the GPL Version 2, indicate your decision by adding |
26 |
* "[Contributor] elects to include this software in this distribution |
27 |
* under the [CDDL or GPL Version 2] license." If you do not indicate a |
28 |
* single choice of license, a recipient has the option to distribute |
29 |
* your version of this file under either the CDDL, the GPL Version 2 or |
30 |
* to extend the choice of license to its licensees as provided above. |
31 |
* However, if you add GPL Version 2 code and therefore, elected the GPL |
32 |
* Version 2 license, then the option applies only if the new code is |
33 |
* made subject to such option by the copyright holder. |
34 |
* |
35 |
* Contributor(s): |
36 |
* |
37 |
* Portions Copyrighted 2009 Sun Microsystems, Inc. |
38 |
*/ |
39 |
|
40 |
/* |
41 |
* AvailableProvidersPanel.java |
42 |
* |
43 |
* Created on 10.4.2009, 12:12:45 |
44 |
*/ |
45 |
|
46 |
package org.netbeans.modules.server.ui.wizard; |
47 |
|
48 |
import java.util.Enumeration; |
49 |
import javax.swing.AbstractButton; |
50 |
import javax.swing.JRadioButton; |
51 |
|
52 |
/** |
53 |
* |
54 |
* @author Jaroslav Tulach <jtulach@netbeans.org> |
55 |
*/ |
56 |
final class AvailableProvidersPanel extends javax.swing.JPanel { |
57 |
|
58 |
/** Creates new form AvailableProvidersPanel */ |
59 |
public AvailableProvidersPanel(JRadioButton[] arr) { |
60 |
initComponents(); |
61 |
|
62 |
radioPanel.removeAll(); |
63 |
for (JRadioButton b : arr) { |
64 |
radioGroup.add(b); |
65 |
radioPanel.add(b); |
66 |
} |
67 |
arr[0].setSelected(true); |
68 |
} |
69 |
|
70 |
public JRadioButton getSelected() { |
71 |
Enumeration<AbstractButton> en = radioGroup.getElements(); |
72 |
while (en.hasMoreElements()) { |
73 |
AbstractButton b = en.nextElement(); |
74 |
if (b.isSelected()) { |
75 |
return (JRadioButton)b; |
76 |
} |
77 |
} |
78 |
throw new IllegalStateException(); |
79 |
} |
80 |
|
81 |
/** This method is called from within the constructor to |
82 |
* initialize the form. |
83 |
* WARNING: Do NOT modify this code. The content of this method is |
84 |
* always regenerated by the Form Editor. |
85 |
*/ |
86 |
@SuppressWarnings("unchecked") |
87 |
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents |
88 |
private void initComponents() { |
89 |
|
90 |
radioGroup = new javax.swing.ButtonGroup(); |
91 |
radioPanel = new javax.swing.JPanel(); |
92 |
jRadioButton2 = new javax.swing.JRadioButton(); |
93 |
jRadioButton3 = new javax.swing.JRadioButton(); |
94 |
msgPanel = new javax.swing.JPanel(); |
95 |
jLabel1 = new javax.swing.JLabel(); |
96 |
|
97 |
radioPanel.setLayout(new java.awt.GridLayout(0, 1)); |
98 |
|
99 |
radioGroup.add(jRadioButton2); |
100 |
jRadioButton2.setText(org.openide.util.NbBundle.getBundle(AvailableProvidersPanel.class).getString("AvailableProvidersPanel.jRadioButton2.text")); // NOI18N |
101 |
radioPanel.add(jRadioButton2); |
102 |
|
103 |
radioGroup.add(jRadioButton3); |
104 |
jRadioButton3.setText(org.openide.util.NbBundle.getBundle(AvailableProvidersPanel.class).getString("AvailableProvidersPanel.jRadioButton3.text")); // NOI18N |
105 |
radioPanel.add(jRadioButton3); |
106 |
|
107 |
jLabel1.setText(org.openide.util.NbBundle.getBundle(AvailableProvidersPanel.class).getString("MSG_AvailableProviders")); // NOI18N |
108 |
|
109 |
javax.swing.GroupLayout msgPanelLayout = new javax.swing.GroupLayout(msgPanel); |
110 |
msgPanel.setLayout(msgPanelLayout); |
111 |
msgPanelLayout.setHorizontalGroup( |
112 |
msgPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
113 |
.addGroup(msgPanelLayout.createSequentialGroup() |
114 |
.addContainerGap() |
115 |
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 402, Short.MAX_VALUE) |
116 |
.addContainerGap()) |
117 |
); |
118 |
msgPanelLayout.setVerticalGroup( |
119 |
msgPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
120 |
.addComponent(jLabel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 99, Short.MAX_VALUE) |
121 |
); |
122 |
|
123 |
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); |
124 |
this.setLayout(layout); |
125 |
layout.setHorizontalGroup( |
126 |
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
127 |
.addComponent(msgPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
128 |
.addGroup(layout.createSequentialGroup() |
129 |
.addGap(12, 12, 12) |
130 |
.addComponent(radioPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 402, Short.MAX_VALUE) |
131 |
.addGap(12, 12, 12)) |
132 |
); |
133 |
layout.setVerticalGroup( |
134 |
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) |
135 |
.addGroup(layout.createSequentialGroup() |
136 |
.addComponent(msgPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) |
137 |
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) |
138 |
.addComponent(radioPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) |
139 |
.addContainerGap()) |
140 |
); |
141 |
}// </editor-fold>//GEN-END:initComponents |
142 |
|
143 |
|
144 |
// Variables declaration - do not modify//GEN-BEGIN:variables |
145 |
private javax.swing.JLabel jLabel1; |
146 |
private javax.swing.JRadioButton jRadioButton2; |
147 |
private javax.swing.JRadioButton jRadioButton3; |
148 |
private javax.swing.JPanel msgPanel; |
149 |
private javax.swing.ButtonGroup radioGroup; |
150 |
private javax.swing.JPanel radioPanel; |
151 |
// End of variables declaration//GEN-END:variables |
152 |
|
153 |
} |