diff options
author | Anthony Balkissoon <abalkiss@redhat.com> | 2005-07-12 15:39:23 +0000 |
---|---|---|
committer | Anthony Balkissoon <abalkiss@redhat.com> | 2005-07-12 15:39:23 +0000 |
commit | 207c473be7fa1837c7265e803402516a4e74cf9a (patch) | |
tree | 4f76b4aa1218d7101b1163c12b4a6f0323ba102a | |
parent | 118439a5407f3c703d08601fd2ad9b6ec079aa00 (diff) | |
download | classpath-207c473be7fa1837c7265e803402516a4e74cf9a.tar.gz |
2005-07-12 Anthony Balkissoon <abalkiss@redhat.com>
* javax/swing/JMenu.java:
(isSelected): Call super.isSelected() instead of super.isArmed().
* javax/swing/plaf/basic/BasicMenuItemUI.java:
(paintMenuItem): Replaced incorrect selection criteria with call to
isSelected().
(paintText): Likewise.
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | javax/swing/JMenu.java | 4 | ||||
-rw-r--r-- | javax/swing/plaf/basic/BasicMenuItemUI.java | 20 |
3 files changed, 19 insertions, 14 deletions
@@ -1,3 +1,12 @@ +2005-07-12 Anthony Balkissoon <abalkiss@redhat.com> + + * javax/swing/JMenu.java: + (isSelected): Call super.isSelected() instead of super.isArmed(). + * javax/swing/plaf/basic/BasicMenuItemUI.java: + (paintMenuItem): Replaced incorrect selection criteria with call to + isSelected(). + (paintText): Likewise. + 2005-07-12 Lillian Angel <langel@redhat.com> * examples/gnu/classpath/examples/swing/Demo.java (mkTreeWorld): Implemented diff --git a/javax/swing/JMenu.java b/javax/swing/JMenu.java index fcf7dcf86..8dcad8b77 100644 --- a/javax/swing/JMenu.java +++ b/javax/swing/JMenu.java @@ -328,7 +328,7 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement */ public boolean isSelected() { - return super.isArmed(); + return super.isSelected(); } /** @@ -351,7 +351,7 @@ public class JMenu extends JMenuItem implements Accessible, MenuElement { super.setArmed(true); super.setSelected(true); - + // FIXME: The popup menu should be shown on the screen after certain // number of seconds pass. The 'delay' property of this menu indicates // this amount of seconds. 'delay' property is 0 by default. diff --git a/javax/swing/plaf/basic/BasicMenuItemUI.java b/javax/swing/plaf/basic/BasicMenuItemUI.java index 5ddeae57c..d5d70779a 100644 --- a/javax/swing/plaf/basic/BasicMenuItemUI.java +++ b/javax/swing/plaf/basic/BasicMenuItemUI.java @@ -506,11 +506,8 @@ public class BasicMenuItemUI extends MenuItemUI br.width += insets.right + insets.left; br.height += insets.top + insets.bottom; - /* Menu item is considered to be highlighted when it is selected. - It is considered to be selected if menu item is inside some menu - and is armed or if it is both armed and pressed */ - if (m.getModel().isArmed() - && (m.getParent() instanceof MenuElement || m.getModel().isPressed())) + // Menu item is considered to be highlighted when it is selected. + if (m.isSelected()) { if (m.isContentAreaFilled()) { @@ -606,12 +603,8 @@ public class BasicMenuItemUI extends MenuItemUI { if (menuItem.isEnabled()) { - /* Menu item is considered to be highlighted when it is selected. - It is considered to be selected if menu item is inside some menu - and is armed or if it is both armed and pressed */ - if (menuItem.getModel().isArmed() - && (menuItem.getParent() instanceof MenuElement - || menuItem.getModel().isPressed())) + // Menu item is considered to be highlighted when it is selected. + if (menuItem.isSelected()) g.setColor(selectionForeground); else g.setColor(menuItem.getForeground()); @@ -619,7 +612,10 @@ public class BasicMenuItemUI extends MenuItemUI else // FIXME: should fix this to use 'disabledForeground', but its // default value in BasicLookAndFeel is null. - g.setColor(Color.gray); + + // FIXME: should there be different foreground colours for selected + // or deselected, when disabled? + g.setColor(Color.gray); int mnemonicIndex = menuItem.getDisplayedMnemonicIndex(); |