Last change
on this file since 16695 was 15445, checked in by Don-vip, 5 years ago |
fix #18210 - fix mode menu (add items properly to display shortcuts) and fix definition of lasso mode to consider it a traditional mapmode
|
-
Property svn:eol-style
set to
native
|
File size:
1.3 KB
|
Line | |
---|
1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.gui;
|
---|
3 |
|
---|
4 | import static org.openstreetmap.josm.tools.I18n.trc;
|
---|
5 |
|
---|
6 | import java.beans.PropertyChangeListener;
|
---|
7 |
|
---|
8 | import javax.swing.Action;
|
---|
9 | import javax.swing.JButton;
|
---|
10 | import javax.swing.JCheckBoxMenuItem;
|
---|
11 | import javax.swing.JMenu;
|
---|
12 | import javax.swing.JMenuItem;
|
---|
13 |
|
---|
14 | /**
|
---|
15 | * Mode menu. Unlike traditional menus, default menu item is based on {@link JCheckBoxMenuItem}.
|
---|
16 | * @since 15445
|
---|
17 | */
|
---|
18 | public class ModeMenu extends JMenu {
|
---|
19 |
|
---|
20 | /**
|
---|
21 | * Constructs a new {@code ModeMenu}.
|
---|
22 | */
|
---|
23 | public ModeMenu() {
|
---|
24 | /* I18N: mnemonic: M */
|
---|
25 | super(trc("menu", "Mode"));
|
---|
26 | }
|
---|
27 |
|
---|
28 | @Override
|
---|
29 | protected JMenuItem createActionComponent(Action a) {
|
---|
30 | JCheckBoxMenuItem mi = new JCheckBoxMenuItem() {
|
---|
31 | @Override
|
---|
32 | protected PropertyChangeListener createActionPropertyChangeListener(Action a) {
|
---|
33 | PropertyChangeListener pcl = createActionChangeListener(this);
|
---|
34 | if (pcl == null) {
|
---|
35 | pcl = super.createActionPropertyChangeListener(a);
|
---|
36 | }
|
---|
37 | return pcl;
|
---|
38 | }
|
---|
39 | };
|
---|
40 | mi.setHorizontalTextPosition(JButton.TRAILING);
|
---|
41 | mi.setVerticalTextPosition(JButton.CENTER);
|
---|
42 | return mi;
|
---|
43 | }
|
---|
44 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.