Last change
on this file since 2646 was 2005, checked in by Gubaer, 15 years ago |
fixed #2367: panel will be empty when undocked from minimized state
cleanup in Toggle Dialog
new: toggle dialog remember position when detached
new: title in toggle dialog
NOTE: this changeset probably breaks plugins, in particular the validator plugin
|
-
Property svn:eol-style
set to
native
|
File size:
1.4 KB
|
Line | |
---|
1 | // License: GPL. Copyright 2007 by Immanuel Scholz and others
|
---|
2 | package org.openstreetmap.josm.gui;
|
---|
3 |
|
---|
4 | import java.awt.event.MouseAdapter;
|
---|
5 | import java.awt.event.MouseEvent;
|
---|
6 | import java.beans.PropertyChangeEvent;
|
---|
7 | import java.beans.PropertyChangeListener;
|
---|
8 |
|
---|
9 | import javax.swing.Action;
|
---|
10 | import javax.swing.JToggleButton;
|
---|
11 |
|
---|
12 | /**
|
---|
13 | * Just a toggle button, with smaller border and icon only to display in
|
---|
14 | * MapFrame toolbars.
|
---|
15 | *
|
---|
16 | * @author imi
|
---|
17 | */
|
---|
18 | public class IconToggleButton extends JToggleButton implements PropertyChangeListener {
|
---|
19 |
|
---|
20 | public boolean groupbutton;
|
---|
21 |
|
---|
22 | /**
|
---|
23 | * Construct the toggle button with the given action.
|
---|
24 | */
|
---|
25 | public IconToggleButton(Action action) {
|
---|
26 | super(action);
|
---|
27 | setText(null);
|
---|
28 |
|
---|
29 | Object o = action.getValue(Action.SHORT_DESCRIPTION);
|
---|
30 | if (o != null) {
|
---|
31 | setToolTipText(o.toString());
|
---|
32 | }
|
---|
33 |
|
---|
34 | action.addPropertyChangeListener(this);
|
---|
35 |
|
---|
36 | addMouseListener(new MouseAdapter(){
|
---|
37 | @Override public void mousePressed(MouseEvent e) {
|
---|
38 | groupbutton = e.getX() > getWidth()/2 && e.getY() > getHeight()/2;
|
---|
39 | }
|
---|
40 | });
|
---|
41 | }
|
---|
42 |
|
---|
43 | public void propertyChange(PropertyChangeEvent evt) {
|
---|
44 | if (evt.getPropertyName().equals("active")) {
|
---|
45 | setSelected((Boolean)evt.getNewValue());
|
---|
46 | requestFocusInWindow();
|
---|
47 | } else if (evt.getPropertyName().equals("selected")) {
|
---|
48 | setSelected((Boolean)evt.getNewValue());
|
---|
49 | }
|
---|
50 | }
|
---|
51 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.