source: osm/applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelPrefPort.java@ 24692

Last change on this file since 24692 was 24692, checked in by malcolmh, 14 years ago

save

File size: 5.4 KB
Line 
1package oseam.panels;
2
3import javax.swing.BorderFactory;
4import javax.swing.JPanel;
5
6import java.awt.Color;
7import java.awt.Dimension;
8import java.awt.Rectangle;
9import java.awt.Font;
10
11import javax.swing.ButtonGroup;
12import javax.swing.ImageIcon;
13import javax.swing.JLabel;
14import javax.swing.JTextField;
15import javax.swing.JComboBox;
16import javax.swing.JCheckBox;
17import javax.swing.JRadioButton;
18
19import oseam.Messages;
20
21import java.awt.Cursor;
22import java.awt.event.ActionListener;
23
24public class PanelPrefPort extends JPanel {
25
26 private ButtonGroup regionButtons = null;
27 private JRadioButton regionAButton = null;
28 private JRadioButton regionBButton = null;
29 private ButtonGroup shapeButtons = null;
30 private JRadioButton pillarButton = null;
31 private JRadioButton sparButton = null;
32 private JRadioButton canButton = null;
33 private JRadioButton floatButton = null;
34 private JRadioButton beaconButton = null;
35 private JRadioButton towerButton = null;
36
37 public PanelPrefPort() {
38 super();
39 initialize();
40 }
41
42 private void initialize() {
43 this.setLayout(null);
44 this.add(getRegionAButton(), null);
45 this.add(getRegionBButton(), null);
46 this.add(getPillarButton(), null);
47 this.add(getSparButton(), null);
48 this.add(getCanButton(), null);
49 this.add(getFloatButton(), null);
50 this.add(getBeaconButton(), null);
51 this.add(getTowerButton(), null);
52
53 regionButtons = new ButtonGroup();
54 regionButtons.add(regionAButton);
55 regionButtons.add(regionBButton);
56 ActionListener alRegion = new ActionListener() {
57 public void actionPerformed(java.awt.event.ActionEvent e) {
58 if (regionAButton.isSelected()) {
59 regionAButton.setEnabled(false);
60 } else {
61 regionAButton.setEnabled(true);
62 }
63 if (regionBButton.isSelected()) {
64 regionBButton.setEnabled(false);
65 } else {
66 regionBButton.setEnabled(true);
67 }
68 }
69 };
70 regionAButton.addActionListener(alRegion);
71 regionBButton.addActionListener(alRegion);
72
73 shapeButtons = new ButtonGroup();
74 shapeButtons.add(pillarButton);
75 shapeButtons.add(sparButton);
76 shapeButtons.add(canButton);
77 shapeButtons.add(floatButton);
78 shapeButtons.add(beaconButton);
79 shapeButtons.add(towerButton);
80 ActionListener alShape = new ActionListener() {
81 public void actionPerformed(java.awt.event.ActionEvent e) {
82 pillarButton.setEnabled(!pillarButton.isSelected());
83 sparButton.setEnabled(!sparButton.isSelected());
84 canButton.setEnabled(!canButton.isSelected());
85 floatButton.setEnabled(!floatButton.isSelected());
86 beaconButton.setEnabled(!beaconButton.isSelected());
87 towerButton.setEnabled(!towerButton.isSelected());
88 }
89 };
90 pillarButton.addActionListener(alShape);
91 sparButton.addActionListener(alShape);
92 canButton.addActionListener(alShape);
93 floatButton.addActionListener(alShape);
94 beaconButton.addActionListener(alShape);
95 towerButton.addActionListener(alShape);
96 }
97
98 private JRadioButton getRegionAButton() {
99 if (regionAButton == null) {
100 regionAButton = new JRadioButton(new ImageIcon(getClass()
101 .getResource("/images/RegionAButton.png")));
102 regionAButton.setBounds(new Rectangle(10, 45, 35, 30));
103 regionAButton.setToolTipText(Messages.getString("RegionATip"));
104 }
105 return regionAButton;
106 }
107
108 private JRadioButton getRegionBButton() {
109 if (regionBButton == null) {
110 regionBButton = new JRadioButton(new ImageIcon(getClass()
111 .getResource("/images/RegionBButton.png")));
112 regionBButton.setBounds(new Rectangle(10, 82, 35, 30));
113 regionBButton.setToolTipText(Messages.getString("RegionBTip"));
114 }
115 return regionBButton;
116 }
117
118 private JRadioButton getPillarButton() {
119 if (pillarButton == null) {
120 pillarButton = new JRadioButton(new ImageIcon(getClass()
121 .getResource("/images/PillarButton.png")));
122 pillarButton.setBounds(new Rectangle(50, 0, 35, 32));
123 pillarButton.setToolTipText(Messages.getString("PillarTip"));
124 }
125 return pillarButton;
126 }
127
128 private JRadioButton getSparButton() {
129 if (sparButton == null) {
130 sparButton = new JRadioButton(new ImageIcon(getClass().getResource(
131 "/images/SparButton.png")));
132 sparButton.setBounds(new Rectangle(50, 32, 35, 32));
133 sparButton.setToolTipText(Messages.getString("SparTip"));
134 }
135 return sparButton;
136 }
137
138 private JRadioButton getCanButton() {
139 if (canButton == null) {
140 canButton = new JRadioButton(new ImageIcon(getClass().getResource(
141 "/images/CanButton.png")));
142 canButton.setBounds(new Rectangle(50, 64, 35, 32));
143 canButton.setToolTipText(Messages.getString("CanTip"));
144 }
145 return canButton;
146 }
147
148 private JRadioButton getFloatButton() {
149 if (floatButton == null) {
150 floatButton = new JRadioButton(new ImageIcon(getClass()
151 .getResource("/images/FloatButton.png")));
152 floatButton.setBounds(new Rectangle(50, 96, 35, 32));
153 floatButton.setToolTipText(Messages.getString("FloatTip"));
154 }
155 return floatButton;
156 }
157
158 private JRadioButton getBeaconButton() {
159 if (beaconButton == null) {
160 beaconButton = new JRadioButton(new ImageIcon(getClass()
161 .getResource("/images/BeaconButton.png")));
162 beaconButton.setBounds(new Rectangle(50, 128, 35, 32));
163 beaconButton.setToolTipText(Messages.getString("BeaconTip"));
164 }
165 return beaconButton;
166 }
167
168 private JRadioButton getTowerButton() {
169 if (towerButton == null) {
170 towerButton = new JRadioButton(new ImageIcon(getClass()
171 .getResource("/images/TowerButton.png")));
172 towerButton.setBounds(new Rectangle(85, 0, 35, 32));
173 towerButton.setToolTipText(Messages.getString("TowerTip"));
174 }
175 return towerButton;
176 }
177
178}
Note: See TracBrowser for help on using the repository browser.