[kaffe] CVS kaffe (robilad): Resynced with GNU Classpath: fixes for swing Label mnemonic handling

Kaffe CVS cvs-commits at kaffe.org
Wed Dec 22 17:05:31 PST 2004


PatchSet 5711 
Date: 2004/12/23 01:01:27
Author: robilad
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath: fixes for swing Label mnemonic handling

Members: 
	ChangeLog:1.3256->1.3257 
	libraries/javalib/javax/swing/JLabel.java:1.5->1.6 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.3256 kaffe/ChangeLog:1.3257
--- kaffe/ChangeLog:1.3256	Thu Dec 23 00:40:18 2004
+++ kaffe/ChangeLog	Thu Dec 23 01:01:27 2004
@@ -1,5 +1,17 @@
 2004-12-22  Dalibor Topic  <robilad at kaffe.org>
 
+	* libraries/javalib/javax/swing/JLabel.java:
+	Resynced with GNU Classpath.
+	
+	2004-12-21  Michael Koch  <konqueror at gmx.de>
+
+	* javax/swing/JLabel.java
+	(setDisplayedMnemonicIndex): Handle index == -1 and fire
+	PropertyChangeEvent after property got set to the new index.
+	(setDisplayedMnemonic): Use only upper case characters.
+	
+2004-12-22  Dalibor Topic  <robilad at kaffe.org>
+
 	* libraries/javalib/javax/swing/JApplet.java,
 	libraries/javalib/javax/swing/JInternalFrame.java,
 	libraries/javalib/javax/swing/JWindow.java:
Index: kaffe/libraries/javalib/javax/swing/JLabel.java
diff -u kaffe/libraries/javalib/javax/swing/JLabel.java:1.5 kaffe/libraries/javalib/javax/swing/JLabel.java:1.6
--- kaffe/libraries/javalib/javax/swing/JLabel.java:1.5	Mon Dec  6 19:06:51 2004
+++ kaffe/libraries/javalib/javax/swing/JLabel.java	Thu Dec 23 01:01:30 2004
@@ -385,7 +385,7 @@
    */
   public void setDisplayedMnemonic(char mnemonic)
   {
-    setDisplayedMnemonic((int) mnemonic);
+    setDisplayedMnemonic((int) Character.toUpperCase(mnemonic));
   }
 
   /**
@@ -399,7 +399,7 @@
   }
 
   /**
-   * This method sets which character in the text will be  the underlined
+   * This method sets which character in the text will be the underlined
    * character. If the given index is -1, then this indicates  that there is
    * no mnemonic. If the index is less than -1 or if the index is equal to
    * the length, this method will throw an IllegalArgumentException.
@@ -410,19 +410,22 @@
    *         length.
    */
   public void setDisplayedMnemonicIndex(int newIndex)
-                                 throws IllegalArgumentException
+    throws IllegalArgumentException
   {
     if (newIndex < -1 || (text != null && newIndex >= text.length()))
       throw new IllegalArgumentException();
 
-    if (text == null || text.charAt(newIndex) != displayedMnemonic)
+    if (newIndex == -1
+        || text == null
+	|| text.charAt(newIndex) != displayedMnemonic)
       newIndex = -1;
 
     if (newIndex != displayedMnemonicIndex)
       {
-	firePropertyChange(DISPLAYED_MNEMONIC_INDEX_CHANGED_PROPERTY,
-	                   displayedMnemonicIndex, newIndex);
+	int oldIndex = displayedMnemonicIndex;
 	displayedMnemonicIndex = newIndex;
+	firePropertyChange(DISPLAYED_MNEMONIC_INDEX_CHANGED_PROPERTY,
+	                   oldIndex, newIndex);
       }
   }
 




More information about the kaffe mailing list