Changeset 24438 in osm for applications/editors/josm/plugins/smed
- Timestamp:
- 2010-11-28T12:06:10+01:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/smed/plugs/harbour
- Files:
-
- 37 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/smed/plugs/harbour/src/harbour/panels/PanelLimits.java
r24426 r24438 15 15 import javax.swing.JCheckBox; 16 16 import java.awt.Font; 17 18 import javax.swing.Icon; 17 19 import javax.swing.JTextField; 18 20 import javax.swing.JComboBox; … … 20 22 import javax.swing.JButton; 21 23 import javax.swing.ImageIcon; 24 import java.awt.Button; 22 25 23 26 … … 39 42 private JCheckBox usCheckBox = null; 40 43 private JCheckBox etaCheckBox = null; 41 private JPanel jPanel = null;44 private JPanel exPanel = null; 42 45 public PanelLimits() { 43 46 super(); … … 80 83 this.add(getUsCheckBox(), null); 81 84 this.add(getEtaCheckBox(), null); 82 this.add(get JPanel(), null);85 this.add(getExPanel(), null); 83 86 } 84 87 … … 176 179 private JButton getGrButton() { 177 180 if (grButton == null) { 178 grButton = new LightTile(""); 181 Icon grey = new ImageIcon(getClass().getResource("/images/anker_grey.png")); 182 Icon green = new ImageIcon(getClass().getResource("/images/anker_green.png")); 183 Icon yellow = new ImageIcon(getClass().getResource("/images/anker_yellow.png")); 184 Icon red = new ImageIcon(getClass().getResource("/images/anker_red.png")); 185 186 grButton = new LightTile(grey, green, yellow, red); 179 187 grButton.setBounds(new Rectangle(164, 220, 50, 20)); 180 grButton.setIcon(new ImageIcon(getClass().getResource("/images/anker.png")));181 188 } 182 189 return grButton; … … 259 266 260 267 /** 261 * This method initializes jPanel268 * This method initializes exPanel 262 269 * 263 270 * @return javax.swing.JPanel 264 271 */ 265 private JPanel get JPanel() {266 if ( jPanel == null) {267 jPanel = new TextFieldEx();268 jPanel.setLayout(null);269 jPanel.setBounds(new Rectangle(135, 95, 190, 112));270 } 271 return jPanel;272 private JPanel getExPanel() { 273 if (exPanel == null) { 274 exPanel = new TextFieldEx(); 275 exPanel.setLayout(null); 276 exPanel.setBounds(new Rectangle(135, 95, 190, 112)); 277 } 278 return exPanel; 272 279 } 273 280 } -
applications/editors/josm/plugins/smed/plugs/harbour/src/harbour/widgets/LightTile.java
r24416 r24438 2 2 3 3 import java.awt.Color; 4 import java.awt.Dimension;5 4 import java.awt.event.ActionEvent; 6 5 import java.awt.event.ActionListener; 7 6 7 import javax.swing.Icon; 8 8 import javax.swing.JButton; 9 9 10 10 public class LightTile extends JButton { 11 11 12 12 /** 13 13 * … … 15 15 private static final long serialVersionUID = 1L; 16 16 17 private JButton tile = null; 17 private JButton tile; 18 private Icon stateGrey; 19 private Icon stateGreen; 20 private Icon stateYellow; 21 private Icon stateRed; 18 22 19 public LightTile( String text) {20 super( text);23 public LightTile(Icon greyState, Icon greenState, Icon yellowState, Icon redState) { 24 super(); 21 25 22 26 tile = this; 27 stateGrey = greyState; 28 stateGreen = greenState; 29 stateYellow = yellowState; 30 stateRed = redState; 23 31 24 32 tile.setBackground(Color.LIGHT_GRAY); 25 33 tile.setToolTipText("Click to change state"); 34 tile.setIcon(stateGrey); 26 35 tile.addActionListener(new ActionListener(){ 27 36 28 37 @Override 29 38 public void actionPerformed(ActionEvent arg0) { 30 if(tile.getBackground() == Color.LIGHT_GRAY) tile.setBackground(Color.GREEN); 31 else if(tile.getBackground() == Color.GREEN) tile.setBackground(Color.YELLOW); 32 else if(tile.getBackground() == Color.YELLOW) tile.setBackground(Color.RED); 33 else if(tile.getBackground() == Color.RED) tile.setBackground(Color.LIGHT_GRAY); 39 if(tile.getBackground() == Color.LIGHT_GRAY) { 40 tile.setBackground(Color.GREEN); 41 tile.setIcon(stateGreen); 42 } else if(tile.getBackground() == Color.GREEN) { 43 tile.setBackground(Color.YELLOW); 44 tile.setIcon(stateYellow); 45 } else if(tile.getBackground() == Color.YELLOW) { 46 tile.setBackground(Color.RED); 47 tile.setIcon(stateRed); 48 } else if(tile.getBackground() == Color.RED) { 49 tile.setBackground(Color.LIGHT_GRAY); 50 tile.setIcon(stateGrey); 51 } 34 52 } 35 53 }); 36 54 37 } 55 } 56 38 57 } -
applications/editors/josm/plugins/smed/plugs/harbour/src/harbour/widgets/Sheltergram.java
r24416 r24438 1 1 package harbour.widgets; 2 2 3 import java.awt.Button; 3 4 import java.awt.Color; 4 5 import java.awt.GridLayout; … … 6 7 import java.util.List; 7 8 9 import javax.swing.Icon; 8 10 import javax.swing.ImageIcon; 9 11 import javax.swing.JButton; … … 18 20 19 21 private JButton tile = null; 20 private String[] dirs = { "nw","n","ne","w","anker","e","sw","s","se" }; 22 private Icon stateGrey; 23 private Icon stateGreen; 24 private Icon stateYellow; 25 private Icon stateRed; 26 private String[] dirs = { "nw","n","ne","w","e","sw","s","se" }; 21 27 22 28 public Sheltergram() { … … 32 38 tile.setBackground(Color.WHITE); 33 39 tile.setEnabled(false); 34 } else tile = new LightTile(""); 40 tile.setIcon(new ImageIcon(getClass().getResource("/images/anker.png"))); 41 } else { 42 stateGrey = new ImageIcon(getClass().getResource("/images/" + dirs[k] + "_grey.png")); 43 stateGreen = new ImageIcon(getClass().getResource("/images/" + dirs[k] + "_green.png")); 44 stateYellow = new ImageIcon(getClass().getResource("/images/" + dirs[k] + "_yellow.png")); 45 stateRed = new ImageIcon(getClass().getResource("/images/" + dirs[k++] + "_red.png")); 46 47 tile = new LightTile(stateGrey, stateGreen, stateYellow, stateRed); 48 } 35 49 36 tile.setIcon(new ImageIcon(getClass().getResource("/images/" + dirs[k++] + ".png")));37 50 tile.setBounds(new Rectangle(j*25,i*25, 25, 25)); 38 51 add(tile);
Note:
See TracChangeset
for help on using the changeset viewer.