001: package com.nexes.test;
002:
003: import java.awt.*;
004: import java.awt.event.*;
005: import javax.swing.*;
006: import javax.swing.border.*;
007:
008: import com.nexes.wizard.*;
009:
010: public class TestPanel2 extends JPanel {
011:
012: private javax.swing.JLabel anotherBlankSpace;
013: private javax.swing.JLabel blankSpace;
014: private javax.swing.ButtonGroup connectorGroup;
015: private javax.swing.JRadioButton ethernetRJRadioButton;
016: private javax.swing.JRadioButton ethernetTenRadioButton;
017: private javax.swing.JCheckBox jCheckBox1;
018: private javax.swing.JLabel jLabel1;
019: private javax.swing.JPanel jPanel1;
020: private javax.swing.JRadioButton notInventedYetRadioButton;
021: private javax.swing.JRadioButton serialParallelRadioButton;
022: private javax.swing.JLabel welcomeTitle;
023: private javax.swing.JRadioButton wirelessRadioButton;
024: private javax.swing.JLabel yetAnotherBlankSpace1;
025:
026: private JPanel contentPanel;
027: private JLabel iconLabel;
028: private JSeparator separator;
029: private JLabel textLabel;
030: private JPanel titlePanel;
031:
032: public TestPanel2() {
033:
034: super ();
035:
036: contentPanel = getContentPanel();
037: contentPanel.setBorder(new EmptyBorder(new Insets(10, 10, 10,
038: 10)));
039:
040: ImageIcon icon = getImageIcon();
041:
042: titlePanel = new javax.swing.JPanel();
043: textLabel = new javax.swing.JLabel();
044: iconLabel = new javax.swing.JLabel();
045: separator = new javax.swing.JSeparator();
046:
047: setLayout(new java.awt.BorderLayout());
048:
049: titlePanel.setLayout(new java.awt.BorderLayout());
050: titlePanel.setBackground(Color.gray);
051:
052: textLabel.setBackground(Color.gray);
053: textLabel.setFont(new Font("MS Sans Serif", Font.BOLD, 14));
054: textLabel.setText("Favorite Connector Type");
055: textLabel
056: .setBorder(new EmptyBorder(new Insets(10, 10, 10, 10)));
057: textLabel.setOpaque(true);
058:
059: iconLabel.setBackground(Color.gray);
060: if (icon != null)
061: iconLabel.setIcon(icon);
062:
063: titlePanel.add(textLabel, BorderLayout.CENTER);
064: titlePanel.add(iconLabel, BorderLayout.EAST);
065: titlePanel.add(separator, BorderLayout.SOUTH);
066:
067: add(titlePanel, BorderLayout.NORTH);
068: JPanel secondaryPanel = new JPanel();
069: secondaryPanel.add(contentPanel, BorderLayout.NORTH);
070: add(secondaryPanel, BorderLayout.WEST);
071:
072: }
073:
074: public void addCheckBoxActionListener(ActionListener l) {
075: jCheckBox1.addActionListener(l);
076: }
077:
078: public boolean isCheckBoxSelected() {
079: return jCheckBox1.isSelected();
080: }
081:
082: public String getRadioButtonSelected() {
083: return connectorGroup.getSelection().getActionCommand();
084: }
085:
086: private JPanel getContentPanel() {
087:
088: JPanel contentPanel1 = new JPanel();
089:
090: connectorGroup = new javax.swing.ButtonGroup();
091: welcomeTitle = new javax.swing.JLabel();
092: jPanel1 = new javax.swing.JPanel();
093: blankSpace = new javax.swing.JLabel();
094: wirelessRadioButton = new javax.swing.JRadioButton();
095: ethernetRJRadioButton = new javax.swing.JRadioButton();
096: ethernetTenRadioButton = new javax.swing.JRadioButton();
097: serialParallelRadioButton = new javax.swing.JRadioButton();
098: notInventedYetRadioButton = new javax.swing.JRadioButton();
099:
100: wirelessRadioButton.setActionCommand("Wireless Radio");
101: ethernetRJRadioButton.setActionCommand("Ethernet RJ-45");
102: ethernetTenRadioButton.setActionCommand("Ethernet 10 base T");
103: serialParallelRadioButton.setActionCommand("Serial/Parallel");
104: notInventedYetRadioButton.setActionCommand("Not Yet Invented");
105:
106: anotherBlankSpace = new javax.swing.JLabel();
107: jCheckBox1 = new javax.swing.JCheckBox();
108: yetAnotherBlankSpace1 = new javax.swing.JLabel();
109: jLabel1 = new javax.swing.JLabel();
110:
111: ethernetRJRadioButton.setSelected(true);
112:
113: contentPanel1.setLayout(new java.awt.BorderLayout());
114:
115: welcomeTitle
116: .setText("Please enter your favorite type of data connector:");
117: contentPanel1.add(welcomeTitle, java.awt.BorderLayout.NORTH);
118:
119: jPanel1.setLayout(new java.awt.GridLayout(0, 1));
120:
121: jPanel1.add(blankSpace);
122:
123: wirelessRadioButton.setText("802.11 b/g");
124: connectorGroup.add(wirelessRadioButton);
125: jPanel1.add(wirelessRadioButton);
126:
127: ethernetRJRadioButton.setText("Ethernet RJ-45");
128: connectorGroup.add(ethernetRJRadioButton);
129: jPanel1.add(ethernetRJRadioButton);
130:
131: ethernetTenRadioButton.setText("Ethernet 10 base T");
132: connectorGroup.add(ethernetTenRadioButton);
133: jPanel1.add(ethernetTenRadioButton);
134:
135: serialParallelRadioButton.setText("Serial/Parallel");
136: connectorGroup.add(serialParallelRadioButton);
137: jPanel1.add(serialParallelRadioButton);
138:
139: notInventedYetRadioButton
140: .setText("Something Not Yet Invented But You're Sure You'll Want It");
141: connectorGroup.add(notInventedYetRadioButton);
142: jPanel1.add(notInventedYetRadioButton);
143:
144: jPanel1.add(anotherBlankSpace);
145:
146: jCheckBox1
147: .setText("I agree to laugh at people who chose options other than mine");
148: jPanel1.add(jCheckBox1);
149:
150: jPanel1.add(yetAnotherBlankSpace1);
151:
152: contentPanel1.add(jPanel1, java.awt.BorderLayout.CENTER);
153:
154: jLabel1
155: .setText("Note that the 'Next' button is disabled until you check the box above.");
156: contentPanel1.add(jLabel1, java.awt.BorderLayout.SOUTH);
157:
158: return contentPanel1;
159: }
160:
161: private ImageIcon getImageIcon() {
162:
163: // Icon to be placed in the upper right corner.
164:
165: return null;
166: }
167:
168: }
|