Ignore:
Timestamp:
2010-11-28T12:06:10+01:00 (14 years ago)
Author:
postfix
Message:

sheltergram works now in windows 7 too

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  
    1515import javax.swing.JCheckBox;
    1616import java.awt.Font;
     17
     18import javax.swing.Icon;
    1719import javax.swing.JTextField;
    1820import javax.swing.JComboBox;
     
    2022import javax.swing.JButton;
    2123import javax.swing.ImageIcon;
     24import java.awt.Button;
    2225
    2326
     
    3942        private JCheckBox usCheckBox = null;
    4043        private JCheckBox etaCheckBox = null;
    41         private JPanel jPanel = null;
     44        private JPanel exPanel = null;
    4245        public PanelLimits() {
    4346                super();
     
    8083        this.add(getUsCheckBox(), null);
    8184        this.add(getEtaCheckBox(), null);
    82         this.add(getJPanel(), null);
     85        this.add(getExPanel(), null);
    8386        }
    8487
     
    176179        private JButton getGrButton() {
    177180                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);
    179187                        grButton.setBounds(new Rectangle(164, 220, 50, 20));
    180                         grButton.setIcon(new ImageIcon(getClass().getResource("/images/anker.png")));
    181188                }
    182189                return grButton;
     
    259266
    260267        /**
    261          * This method initializes jPanel       
     268         * This method initializes exPanel     
    262269         *     
    263270         * @return javax.swing.JPanel   
    264271         */
    265         private JPanel getJPanel() {
    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;
    272279        }
    273280}
  • applications/editors/josm/plugins/smed/plugs/harbour/src/harbour/widgets/LightTile.java

    r24416 r24438  
    22
    33import java.awt.Color;
    4 import java.awt.Dimension;
    54import java.awt.event.ActionEvent;
    65import java.awt.event.ActionListener;
    76
     7import javax.swing.Icon;
    88import javax.swing.JButton;
    99
    1010public class LightTile extends JButton {
    11        
     11
    1212        /**
    1313         *
     
    1515        private static final long serialVersionUID = 1L;
    1616       
    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;
    1822       
    19         public LightTile(String text) {
    20                 super(text);
     23        public LightTile(Icon greyState, Icon greenState, Icon yellowState, Icon redState) {
     24                super();
    2125               
    2226                tile = this;
     27                stateGrey   = greyState;
     28                stateGreen  = greenState;
     29                stateYellow = yellowState;
     30                stateRed    = redState;
    2331               
    2432                tile.setBackground(Color.LIGHT_GRAY);
    2533                tile.setToolTipText("Click to change state");
     34                tile.setIcon(stateGrey);
    2635                tile.addActionListener(new ActionListener(){
    2736
    2837                        @Override
    2938                        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                                }
    3452                        }
    3553                });
    3654
    37         }       
     55        }
     56
    3857}
  • applications/editors/josm/plugins/smed/plugs/harbour/src/harbour/widgets/Sheltergram.java

    r24416 r24438  
    11package harbour.widgets;
    22
     3import java.awt.Button;
    34import java.awt.Color;
    45import java.awt.GridLayout;
     
    67import java.util.List;
    78
     9import javax.swing.Icon;
    810import javax.swing.ImageIcon;
    911import javax.swing.JButton;
     
    1820       
    1921        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" };
    2127       
    2228        public Sheltergram() {
     
    3238                                        tile.setBackground(Color.WHITE);
    3339                                        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                                }
    3549                               
    36                                 tile.setIcon(new ImageIcon(getClass().getResource("/images/" + dirs[k++] + ".png")));
    3750                                tile.setBounds(new Rectangle(j*25,i*25, 25, 25));
    3851                                add(tile);
Note: See TracChangeset for help on using the changeset viewer.