Last change
on this file since 260 was 99, checked in by imi, 18 years ago |
- added GeoImage feature (showing images on a tracklog)
- added zoom slider
- added Escape cancels selection rectangle
- added "Save password" option to Auth-dialog
- fixed that redo/undo buttons were not enabled
- fixed hotkeys beeing inaccessible when no data is loaded
|
File size:
1.1 KB
|
Line | |
---|
1 | package org.openstreetmap.josm.gui;
|
---|
2 |
|
---|
3 | import java.awt.event.MouseAdapter;
|
---|
4 | import java.awt.event.MouseEvent;
|
---|
5 | import java.beans.PropertyChangeEvent;
|
---|
6 | import java.beans.PropertyChangeListener;
|
---|
7 |
|
---|
8 | import javax.swing.Action;
|
---|
9 | import javax.swing.JToggleButton;
|
---|
10 |
|
---|
11 | /**
|
---|
12 | * Just a toggle button, with smaller border and icon only to display in
|
---|
13 | * MapFrame toolbars.
|
---|
14 | *
|
---|
15 | * @author imi
|
---|
16 | */
|
---|
17 | public class IconToggleButton extends JToggleButton implements PropertyChangeListener {
|
---|
18 |
|
---|
19 | public boolean groupbutton;
|
---|
20 |
|
---|
21 | /**
|
---|
22 | * Construct the toggle button with the given action.
|
---|
23 | */
|
---|
24 | public IconToggleButton(Action action) {
|
---|
25 | super(action);
|
---|
26 | setText(null);
|
---|
27 |
|
---|
28 | Object o = action.getValue(Action.SHORT_DESCRIPTION);
|
---|
29 | if (o != null)
|
---|
30 | setToolTipText(o.toString());
|
---|
31 |
|
---|
32 | action.addPropertyChangeListener(this);
|
---|
33 |
|
---|
34 | addMouseListener(new MouseAdapter(){
|
---|
35 | @Override public void mousePressed(MouseEvent e) {
|
---|
36 | groupbutton = e.getX() > getWidth()/2 && e.getY() > getHeight()/2;
|
---|
37 | }
|
---|
38 | });
|
---|
39 | }
|
---|
40 |
|
---|
41 | public void propertyChange(PropertyChangeEvent evt) {
|
---|
42 | if (evt.getPropertyName().equals("active")) {
|
---|
43 | setSelected((Boolean)evt.getNewValue());
|
---|
44 | requestFocusInWindow();
|
---|
45 | }
|
---|
46 | }
|
---|
47 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.