Changeset 11341 in josm for trunk/src/org
- Timestamp:
- 2016-11-28T21:19:04+01:00 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/MenuItemSearchDialog.java
r11040 r11341 8 8 import java.awt.event.ActionEvent; 9 9 import java.awt.event.KeyEvent; 10 import java.util.Optional; 10 11 11 12 import javax.swing.DefaultListCellRenderer; 12 import javax.swing.JLabel;13 13 import javax.swing.JList; 14 14 import javax.swing.JMenuItem; … … 94 94 public Component getListCellRendererComponent(JList<? extends JMenuItem> list, JMenuItem value, int index, 95 95 boolean isSelected, boolean cellHasFocus) { 96 final JLabel label = (JLabel) def.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);97 label.setText(value.getText());98 label.setIcon(value.getIcon());99 label.setEnabled(value.isEnabled());100 96 final JMenuItem item = new JMenuItem(value.getText()); 101 97 item.setAction(value.getAction()); 98 Optional.ofNullable(value.getAction()) 99 .filter(JosmAction.class::isInstance) 100 .map(JosmAction.class::cast) 101 .map(JosmAction::getShortcut) 102 .map(Shortcut::getKeyStroke) 103 .ifPresent(item::setAccelerator); 102 104 if (isSelected) { 103 105 item.setBackground(list.getSelectionBackground());
Note:
See TracChangeset
for help on using the changeset viewer.