Last change
on this file since 30 was 30, checked in by imi, 19 years ago |
- Removed edit layer, combine action, save gpx (integrated in normal save)
- Simplified and unified shortkeys
- many small code simplifications
- added undo
- broken checkin!
|
File size:
972 bytes
|
Rev | Line | |
---|
[1] | 1 | package org.openstreetmap.josm.gui;
|
---|
| 2 |
|
---|
[7] | 3 | import java.beans.PropertyChangeEvent;
|
---|
| 4 | import java.beans.PropertyChangeListener;
|
---|
| 5 |
|
---|
[1] | 6 | import javax.swing.Action;
|
---|
[4] | 7 | import javax.swing.JComponent;
|
---|
[1] | 8 | import javax.swing.JToggleButton;
|
---|
| 9 |
|
---|
| 10 | /**
|
---|
| 11 | * Just a toggle button, with smaller border and icon only to display in
|
---|
| 12 | * MapFrame toolbars.
|
---|
| 13 | *
|
---|
| 14 | * @author imi
|
---|
| 15 | */
|
---|
[7] | 16 | public class IconToggleButton extends JToggleButton implements PropertyChangeListener {
|
---|
[1] | 17 |
|
---|
| 18 | /**
|
---|
| 19 | * Construct the toggle button with the given action.
|
---|
| 20 | */
|
---|
[4] | 21 | public IconToggleButton(JComponent acceleratorReceiver, Action action) {
|
---|
[1] | 22 | super(action);
|
---|
| 23 | setText(null);
|
---|
[7] | 24 |
|
---|
| 25 | // Tooltip
|
---|
| 26 | String toolTipText = "";
|
---|
[30] | 27 | Object o = action.getValue(Action.SHORT_DESCRIPTION);
|
---|
[4] | 28 | if (o != null)
|
---|
[30] | 29 | toolTipText = o.toString();
|
---|
[7] | 30 | setToolTipText(toolTipText);
|
---|
| 31 |
|
---|
| 32 | action.addPropertyChangeListener(this);
|
---|
[1] | 33 | }
|
---|
[7] | 34 |
|
---|
| 35 | public void propertyChange(PropertyChangeEvent evt) {
|
---|
[8] | 36 | if (evt.getPropertyName().equals("active"))
|
---|
[7] | 37 | setSelected((Boolean)evt.getNewValue());
|
---|
| 38 | }
|
---|
[1] | 39 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.