Changeset 18227 in josm for trunk/src


Ignore:
Timestamp:
2021-09-27T00:23:49+02:00 (3 years ago)
Author:
Don-vip
Message:

fix #21349 - ClassCastException when opening Keyboard Shortcuts panel (patch by marcello)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/preferences/shortcut/PrefJPanel.java

    r17787 r18227  
    1919
    2020import javax.swing.AbstractAction;
    21 import javax.swing.BoxLayout;
    22 import javax.swing.DefaultComboBoxModel;
    2321import javax.swing.JCheckBox;
    2422import javax.swing.JLabel;
     
    189187    private void initComponents() {
    190188        CbAction action = new CbAction(this);
    191         setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    192         add(buildFilterPanel());
     189        GBC gbc = GBC.eol().insets(3).fill(GBC.HORIZONTAL);
     190
     191        setLayout(new GridBagLayout());
     192        add(buildFilterPanel(), gbc);
    193193
    194194        // This is the list of shortcuts:
     
    206206        listScrollPane.setViewportView(shortcutTable);
    207207
    208         JPanel listPane = new JPanel(new GridLayout());
    209         listPane.add(listScrollPane);
    210         add(listPane);
     208        gbc.weighty = 1;
     209        add(listScrollPane, gbc.fill(GBC.BOTH));
    211210
    212211        // and here follows the edit area. I won't object to someone re-designing it, it looks, um, "minimalistic" ;)
     
    223222        cbAlt.setText(ALT); // see above for why no tr()
    224223        tfKey.setAction(action);
    225         tfKey.setModel(new DefaultComboBoxModel<>(keyList.values().toArray(new String[keyList.size()])));
     224        tfKey.getModel().addAllElements(keyList.values());
    226225        cbMeta.setAction(action);
    227226        cbMeta.setText(META); // see above for why no tr()
     
    243242        action.actionPerformed(null); // init checkboxes
    244243
    245         add(shortcutEditPane);
     244        gbc.weighty = 0;
     245        add(shortcutEditPane, gbc);
    246246    }
    247247
Note: See TracChangeset for help on using the changeset viewer.