Changeset 24633 in osm for applications/editors/josm/plugins/smed
- Timestamp:
- 2010-12-06T23:19:45+01:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed/plugs/oseam/src/oseam/panels/PanelSpec.java
r24613 r24633 1 1 package oseam.panels; 2 3 import static org.openstreetmap.josm.tools.I18n.tr; 2 4 3 5 import javax.swing.BorderFactory; … … 35 37 private JRadioButton beaconButton = null; 36 38 private JRadioButton towerButton = null; 39 private JLabel colourLabel = null; 40 private ButtonGroup colourButtons = null; 41 private JRadioButton whiteButton = null; 42 private JRadioButton redButton = null; 43 private JRadioButton orangeButton = null; 44 private JRadioButton amberButton = null; 45 private JRadioButton yellowButton = null; 46 private JRadioButton greenButton = null; 47 private JRadioButton blueButton = null; 48 private JRadioButton violetButton = null; 49 private JRadioButton blackButton = null; 37 50 38 51 public PanelSpec() { … … 89 102 beaconButton.addActionListener(alShape); 90 103 towerButton.addActionListener(alShape); 104 105 colourLabel = new JLabel(); 106 colourLabel.setBounds(new Rectangle(30, 5, 60, 20)); 107 colourLabel.setText(tr("Colour:")); 108 this.add(colourLabel, null); 109 this.add(getWhiteButton(), null); 110 this.add(getRedButton(), null); 111 this.add(getOrangeButton(), null); 112 this.add(getAmberButton(), null); 113 this.add(getYellowButton(), null); 114 this.add(getGreenButton(), null); 115 this.add(getBlueButton(), null); 116 this.add(getVioletButton(), null); 117 this.add(getBlackButton(), null); 118 colourButtons = new ButtonGroup(); 119 colourButtons.add(whiteButton); 120 colourButtons.add(redButton); 121 colourButtons.add(orangeButton); 122 colourButtons.add(amberButton); 123 colourButtons.add(yellowButton); 124 colourButtons.add(greenButton); 125 colourButtons.add(blueButton); 126 colourButtons.add(violetButton); 127 colourButtons.add(blackButton); 128 ActionListener alColour = new ActionListener() { 129 public void actionPerformed(java.awt.event.ActionEvent e) { 130 whiteButton.setEnabled(!whiteButton.isSelected()); 131 redButton.setEnabled(!redButton.isSelected()); 132 orangeButton.setEnabled(!orangeButton.isSelected()); 133 amberButton.setEnabled(!amberButton.isSelected()); 134 yellowButton.setEnabled(!yellowButton.isSelected()); 135 greenButton.setEnabled(!greenButton.isSelected()); 136 blueButton.setEnabled(!blueButton.isSelected()); 137 violetButton.setEnabled(!violetButton.isSelected()); 138 blackButton.setEnabled(!blackButton.isSelected()); 139 } 140 }; 141 whiteButton.addActionListener(alColour); 142 redButton.addActionListener(alColour); 143 orangeButton.addActionListener(alColour); 144 amberButton.addActionListener(alColour); 145 yellowButton.addActionListener(alColour); 146 greenButton.addActionListener(alColour); 147 blueButton.addActionListener(alColour); 148 violetButton.addActionListener(alColour); 149 blackButton.addActionListener(alColour); 91 150 } 92 151 … … 181 240 } 182 241 242 private JRadioButton getWhiteButton() { 243 if (whiteButton == null) { 244 whiteButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/WhiteButton.png"))); 245 whiteButton.setBounds(new Rectangle(4, 32, 33, 32)); 246 whiteButton.setToolTipText(tr("White")); 247 } 248 return whiteButton; 249 } 250 251 private JRadioButton getRedButton() { 252 if (redButton == null) { 253 redButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/RedButton.png"))); 254 redButton.setBounds(new Rectangle(37, 32, 33, 32)); 255 redButton.setToolTipText(tr("Red")); 256 } 257 return redButton; 258 } 259 260 private JRadioButton getOrangeButton() { 261 if (orangeButton == null) { 262 orangeButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/OrangeButton.png"))); 263 orangeButton.setBounds(new Rectangle(70, 32, 33, 32)); 264 orangeButton.setToolTipText(tr("Orange")); 265 } 266 return orangeButton; 267 } 268 269 private JRadioButton getAmberButton() { 270 if (amberButton == null) { 271 amberButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/AmberButton.png"))); 272 amberButton.setBounds(new Rectangle(4, 64, 33, 32)); 273 amberButton.setToolTipText(tr("Amber")); 274 } 275 return amberButton; 276 } 277 278 private JRadioButton getYellowButton() { 279 if (yellowButton == null) { 280 yellowButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/YellowButton.png"))); 281 yellowButton.setBounds(new Rectangle(37, 64, 33, 32)); 282 yellowButton.setToolTipText(tr("Yellow")); 283 } 284 return yellowButton; 285 } 286 287 private JRadioButton getGreenButton() { 288 if (greenButton == null) { 289 greenButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/GreenButton.png"))); 290 greenButton.setBounds(new Rectangle(70, 64, 33, 32)); 291 greenButton.setToolTipText(tr("Green")); 292 } 293 return greenButton; 294 } 295 296 private JRadioButton getBlueButton() { 297 if (blueButton == null) { 298 blueButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/BlueButton.png"))); 299 blueButton.setBounds(new Rectangle(4, 96, 33, 32)); 300 blueButton.setToolTipText(tr("Blue")); 301 } 302 return blueButton; 303 } 304 305 private JRadioButton getVioletButton() { 306 if (violetButton == null) { 307 violetButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/VioletButton.png"))); 308 violetButton.setBounds(new Rectangle(37, 96, 33, 32)); 309 violetButton.setToolTipText(tr("Violet")); 310 } 311 return violetButton; 312 } 313 314 private JRadioButton getBlackButton() { 315 if (blackButton == null) { 316 blackButton = new JRadioButton(new ImageIcon(getClass().getResource("/images/BlackButton.png"))); 317 blackButton.setBounds(new Rectangle(70, 96, 33, 32)); 318 blackButton.setToolTipText(tr("Black")); 319 } 320 return blackButton; 321 } 322 183 323 }
Note:
See TracChangeset
for help on using the changeset viewer.