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

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

more port panels

File size: 3.3 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 PanelSafeWater extends JPanel {
25
26 private ButtonGroup shapeButtons = null;
27 private JRadioButton pillarButton = null;
28 private JRadioButton sparButton = null;
29 private JRadioButton sphereButton = null;
30 private JRadioButton barrelButton = null;
31 private JRadioButton floatButton = null;
32
33 public PanelSafeWater() {
34 super();
35 initialize();
36 }
37
38 private void initialize() {
39 this.setLayout(null);
40 this.add(getPillarButton(), null);
41 this.add(getSparButton(), null);
42 this.add(getSphereButton(), null);
43 this.add(getBarrelButton(), null);
44 this.add(getFloatButton(), null);
45
46 shapeButtons = new ButtonGroup();
47 shapeButtons.add(pillarButton);
48 shapeButtons.add(sparButton);
49 shapeButtons.add(sphereButton);
50 shapeButtons.add(barrelButton);
51 shapeButtons.add(floatButton);
52 ActionListener alShape = new ActionListener() {
53 public void actionPerformed(java.awt.event.ActionEvent e) {
54 pillarButton.setEnabled(!pillarButton.isSelected());
55 sparButton.setEnabled(!sparButton.isSelected());
56 sphereButton.setEnabled(!sphereButton.isSelected());
57 barrelButton.setEnabled(!barrelButton.isSelected());
58 floatButton.setEnabled(!floatButton.isSelected());
59 }
60 };
61 pillarButton.addActionListener(alShape);
62 sparButton.addActionListener(alShape);
63 sphereButton.addActionListener(alShape);
64 barrelButton.addActionListener(alShape);
65 floatButton.addActionListener(alShape);
66 }
67
68 private JRadioButton getPillarButton() {
69 if (pillarButton == null) {
70 pillarButton = new JRadioButton(new ImageIcon(getClass().getResource(
71 Messages.getString("PillarButton"))));
72 pillarButton.setBounds(new Rectangle(0, 0, 90, 32));
73 }
74 return pillarButton;
75 }
76
77 private JRadioButton getSparButton() {
78 if (sparButton == null) {
79 sparButton = new JRadioButton(new ImageIcon(getClass().getResource(
80 Messages.getString("SparButton"))));
81 sparButton.setBounds(new Rectangle(0, 32, 90, 32));
82 }
83 return sparButton;
84 }
85
86 private JRadioButton getSphereButton() {
87 if (sphereButton == null) {
88 sphereButton = new JRadioButton(new ImageIcon(getClass().getResource(
89 Messages.getString("SphereButton"))));
90 sphereButton.setBounds(new Rectangle(0, 64, 90, 32));
91 }
92 return sphereButton;
93 }
94
95 private JRadioButton getBarrelButton() {
96 if (barrelButton == null) {
97 barrelButton = new JRadioButton(new ImageIcon(getClass().getResource(
98 Messages.getString("BarrelButton"))));
99 barrelButton.setBounds(new Rectangle(0, 96, 90, 32));
100 }
101 return barrelButton;
102 }
103
104 private JRadioButton getFloatButton() {
105 if (floatButton == null) {
106 floatButton = new JRadioButton(new ImageIcon(getClass().getResource(
107 Messages.getString("FloatButton"))));
108 floatButton.setBounds(new Rectangle(0, 128, 90, 32));
109 }
110 return floatButton;
111 }
112
113}
Note: See TracBrowser for help on using the repository browser.