Changeset 85 in josm


Ignore:
Timestamp:
Apr 19, 2006 8:51:33 PM (7 years ago)
Author:
imi
Message:

fixed Exception for MacOS L&F which does not have mnemonics for OK/Cancel

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/org/openstreetmap/josm/gui/PreferenceDialog.java

    r81 r85  
    5757                        super(UIManager.getString("OptionPane.okButtonText"),  
    5858                                        UIManager.getIcon("OptionPane.okIcon")); 
    59                         putValue(MNEMONIC_KEY, new Integer((String)UIManager.get("OptionPane.okButtonMnemonic"))); 
     59                        try { 
     60                                putValue(MNEMONIC_KEY, new Integer((String)UIManager.get("OptionPane.okButtonMnemonic"))); 
     61                        } catch (NumberFormatException e) { 
     62                                // just don't set the mnemonic 
     63                        } 
    6064                } 
    6165                public void actionPerformed(ActionEvent e) { 
     
    9397                        super(UIManager.getString("OptionPane.cancelButtonText"),  
    9498                                        UIManager.getIcon("OptionPane.cancelIcon")); 
    95                         putValue(MNEMONIC_KEY, new Integer((String)UIManager.get("OptionPane.cancelButtonMnemonic"))); 
     99                        try { 
     100                                putValue(MNEMONIC_KEY, new Integer((String)UIManager.get("OptionPane.cancelButtonMnemonic"))); 
     101                        } catch (NumberFormatException e) { 
     102                                // just don't set the mnemonic 
     103                        } 
    96104                } 
    97105                public void actionPerformed(ActionEvent e) { 
     
    107115         * ComboBox with all look and feels. 
    108116         */ 
    109     private JComboBox lafCombo = new JComboBox(UIManager.getInstalledLookAndFeels()); 
     117        private JComboBox lafCombo = new JComboBox(UIManager.getInstalledLookAndFeels()); 
    110118        /** 
    111119         * Combobox with all projections available 
    112120         */ 
    113     private JComboBox projectionCombo = new JComboBox(Projection.allProjections); 
     121        private JComboBox projectionCombo = new JComboBox(Projection.allProjections); 
    114122        /** 
    115123         * The main tab panel. 
     
    120128         * Editfield for the Base url to the REST API from OSM.  
    121129         */ 
    122     private JTextField osmDataServer = new JTextField(20); 
     130        private JTextField osmDataServer = new JTextField(20); 
    123131        /** 
    124132         * Editfield for the username to the OSM account. 
    125133         */ 
    126     private JTextField osmDataUsername = new JTextField(20); 
     134        private JTextField osmDataUsername = new JTextField(20); 
    127135        /** 
    128136         * Passwordfield for the userpassword of the REST API. 
    129137         */ 
    130     private JPasswordField osmDataPassword = new JPasswordField(20); 
    131     /** 
    132     * Base url of the WMS server. Holds everything except the bbox= argument. 
    133     */ 
     138        private JPasswordField osmDataPassword = new JPasswordField(20); 
     139        /** 
     140        * Base url of the WMS server. Holds everything except the bbox= argument. 
     141        */ 
    134142        private JTextField wmsServerBaseUrl = new JTextField(20); 
    135143        /** 
     
    137145         * data line should be interpreted as one. 
    138146         */ 
    139     private JTextField csvImportString = new JTextField(20); 
     147        private JTextField csvImportString = new JTextField(20); 
    140148        /** 
    141149         * The checkbox stating whether nodes should be merged together. 
    142150         */ 
    143     private JCheckBox drawRawGpsLines = new JCheckBox("Draw lines between raw gps points."); 
     151        private JCheckBox drawRawGpsLines = new JCheckBox("Draw lines between raw gps points."); 
    144152        /** 
    145153         * The checkbox stating whether raw gps lines should be forced. 
    146154         */ 
    147     private JCheckBox forceRawGpsLines = new JCheckBox("Force lines if no line segments imported."); 
    148  
    149     private JTable colors; 
    150          
    151          
     155        private JCheckBox forceRawGpsLines = new JCheckBox("Force lines if no line segments imported."); 
     156 
     157        private JTable colors; 
     158 
     159 
    152160        /** 
    153161         * Create a preference setting dialog from an preferences-file. If the file does not 
     
    191199                        } 
    192200                }); 
    193                  
     201 
    194202                // drawRawGpsLines 
    195203                drawRawGpsLines.addActionListener(new ActionListener(){ 
     
    204212                osmDataUsername.setText(Main.pref.get("osm-server.username")); 
    205213                osmDataPassword.setText(Main.pref.get("osm-server.password")); 
    206         wmsServerBaseUrl.setText(Main.pref.get("wmsServerBaseUrl", "http://wms.jpl.nasa.gov/wms.cgi?request=GetMap&width=512&height=512&layers=global_mosaic&styles=&srs=EPSG:4326&format=image/jpeg&")); 
    207         csvImportString.setText(Main.pref.get("csvImportString")); 
     214                wmsServerBaseUrl.setText(Main.pref.get("wmsServerBaseUrl", "http://wms.jpl.nasa.gov/wms.cgi?request=GetMap&width=512&height=512&layers=global_mosaic&styles=&srs=EPSG:4326&format=image/jpeg&")); 
     215                csvImportString.setText(Main.pref.get("csvImportString")); 
    208216                drawRawGpsLines.setSelected(Main.pref.getBoolean("drawRawGpsLines")); 
    209217                forceRawGpsLines.setToolTipText("Force drawing of lines if the imported data contain no line information."); 
     
    211219                forceRawGpsLines.setEnabled(drawRawGpsLines.isSelected()); 
    212220 
    213                  
    214                  
     221 
     222 
    215223                Map<String,String> allColors = new TreeMap<String, String>(Main.pref.getAllPrefix("color.")); 
    216224 
     
    244252                }); 
    245253                colors.getColumnModel().getColumn(1).setWidth(100); 
    246                  
     254 
    247255                JButton colorEdit = new JButton("Choose"); 
    248256                colorEdit.addActionListener(new ActionListener(){ 
     
    264272                osmDataUsername.setToolTipText("Login name (email) to the OSM account."); 
    265273                osmDataPassword.setToolTipText("Login password to the OSM account. Leave blank to not store any password."); 
    266         wmsServerBaseUrl.setToolTipText("The base URL to the server retrieving WMS background pictures from."); 
     274                wmsServerBaseUrl.setToolTipText("The base URL to the server retrieving WMS background pictures from."); 
    267275                csvImportString.setToolTipText("<html>Import string specification. lat/lon and time are imported.<br>" + 
    268276                                "<b>lat</b>: The latitude coordinate<br>" + 
     
    271279                                "<b>ignore</b>: Skip this field<br>" + 
    272280                                "An example: \"ignore ignore lat lon\" will use ' ' as delimiter, skip the first two values and read then lat/lon.<br>" + 
    273                                 "Other example: \"lat,lon\" will just read lat/lon values comma seperated.</html>"); 
     281                "Other example: \"lat,lon\" will just read lat/lon values comma seperated.</html>"); 
    274282                drawRawGpsLines.setToolTipText("If your gps device draw to few lines, select this to draw lines along your way."); 
    275283                colors.setToolTipText("Colors used by different objects in JOSM."); 
    276                  
     284 
    277285                // creating the gui 
    278                  
     286 
    279287                // Display tab 
    280288                JPanel display = createPreferenceTab("display", "Display Settings", "Various settings that influence the visual representation of the whole program."); 
     
    301309                                "WARNING: The password is stored in plain text in the preferences file.<br>" + 
    302310                                "The password is transfered in plain text to the server, encoded in the url.<br>" + 
    303                                 "<b>Do not use a valuable Password.</b></html>"); 
     311                "<b>Do not use a valuable Password.</b></html>"); 
    304312                warning.setFont(warning.getFont().deriveFont(Font.ITALIC)); 
    305313                con.add(warning, GBC.eop().fill(GBC.HORIZONTAL)); 
     
    310318                con.add(csvImportString, GBC.eop().fill(GBC.HORIZONTAL)); 
    311319                con.add(Box.createVerticalGlue(), GBC.eol().fill(GBC.VERTICAL)); 
    312                  
     320 
    313321                // Map tab 
    314322                JPanel map = createPreferenceTab("map", "Map Settings", "Settings for the map projection and data interpretation."); 
     
    320328 
    321329                tabPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); 
    322          
     330 
    323331                // OK/Cancel panel at bottom 
    324332                JPanel okPanel = new JPanel(new GridBagLayout()); 
     
    350358                JPanel p = new JPanel(new GridBagLayout()); 
    351359                p.add(new JLabel(title), GBC.eol().anchor(GBC.CENTER).insets(0,5,0,10)); 
    352                  
     360 
    353361                JLabel descLabel = new JLabel("<html>"+desc+"</html>"); 
    354362                descLabel.setFont(descLabel.getFont().deriveFont(Font.ITALIC)); 
Note: See TracChangeset for help on using the changeset viewer.