Last change
on this file since 90 was 90, checked in by imi, 18 years ago |
- fixed that toggle dialog buttons are sync with the dialogs
- added search for timestamp (e.g. timestamp:06-3-25)
|
File size:
838 bytes
|
Line | |
---|
1 | package org.openstreetmap.josm.gui;
|
---|
2 |
|
---|
3 | import java.beans.PropertyChangeEvent;
|
---|
4 | import java.beans.PropertyChangeListener;
|
---|
5 |
|
---|
6 | import javax.swing.Action;
|
---|
7 | import javax.swing.JToggleButton;
|
---|
8 |
|
---|
9 | /**
|
---|
10 | * Just a toggle button, with smaller border and icon only to display in
|
---|
11 | * MapFrame toolbars.
|
---|
12 | *
|
---|
13 | * @author imi
|
---|
14 | */
|
---|
15 | public class IconToggleButton extends JToggleButton implements PropertyChangeListener {
|
---|
16 |
|
---|
17 | /**
|
---|
18 | * Construct the toggle button with the given action.
|
---|
19 | */
|
---|
20 | public IconToggleButton(Action action) {
|
---|
21 | super(action);
|
---|
22 | setText(null);
|
---|
23 |
|
---|
24 | Object o = action.getValue(Action.SHORT_DESCRIPTION);
|
---|
25 | if (o != null)
|
---|
26 | setToolTipText(o.toString());
|
---|
27 |
|
---|
28 | action.addPropertyChangeListener(this);
|
---|
29 | }
|
---|
30 |
|
---|
31 | public void propertyChange(PropertyChangeEvent evt) {
|
---|
32 | if (evt.getPropertyName().equals("active"))
|
---|
33 | setSelected((Boolean)evt.getNewValue());
|
---|
34 | }
|
---|
35 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.