commit-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commit-cp] classpath ChangeLog javax/swing/JLabel.java


From: David Gilbert
Subject: [commit-cp] classpath ChangeLog javax/swing/JLabel.java
Date: Thu, 22 Jun 2006 09:04:15 +0000

CVSROOT:        /sources/classpath
Module name:    classpath
Changes by:     David Gilbert <trebligd>        06/06/22 09:04:15

Modified files:
        .              : ChangeLog 
        javax/swing    : JLabel.java 

Log message:
        2006-06-22  David Gilbert  <address@hidden>
        
                * javax/swing/JLabel.java
                (setDisplayedMnemonic): Updated API docs,
                (getDisplayedMnemonic): Removed unnecessary type-cast,
                (setDisplayedMnemonicIndex): Removed unnecessary validation, 
                (getDisplayedMnemonicIndex): Updated API docs.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/classpath/ChangeLog?cvsroot=classpath&r1=1.7906&r2=1.7907
http://cvs.savannah.gnu.org/viewcvs/classpath/javax/swing/JLabel.java?cvsroot=classpath&r1=1.36&r2=1.37

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/classpath/classpath/ChangeLog,v
retrieving revision 1.7906
retrieving revision 1.7907
diff -u -b -r1.7906 -r1.7907
--- ChangeLog   21 Jun 2006 21:01:30 -0000      1.7906
+++ ChangeLog   22 Jun 2006 09:04:14 -0000      1.7907
@@ -1,3 +1,11 @@
+2006-06-22  David Gilbert  <address@hidden>
+
+       * javax/swing/JLabel.java
+       (setDisplayedMnemonic): Updated API docs,
+       (getDisplayedMnemonic): Removed unnecessary type-cast,
+       (setDisplayedMnemonicIndex): Removed unnecessary validation, 
+       (getDisplayedMnemonicIndex): Updated API docs.
+
 2006-06-21  David Gilbert  <address@hidden>
 
        * javax/swing/DefaultListSelectionModel.java

Index: javax/swing/JLabel.java
===================================================================
RCS file: /sources/classpath/classpath/javax/swing/JLabel.java,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -b -r1.36 -r1.37
--- javax/swing/JLabel.java     22 May 2006 22:16:05 -0000      1.36
+++ javax/swing/JLabel.java     22 Jun 2006 09:04:15 -0000      1.37
@@ -615,13 +615,14 @@
    * focus to that component when the mnemonic is activated.
    *
    * @param mnemonic The keycode to use for the mnemonic.
+   * 
+   * @see #getDisplayedMnemonic()
    */
   public void setDisplayedMnemonic(int mnemonic)
   {
     if (displayedMnemonic != mnemonic)
       {
-       firePropertyChange("displayedMnemonic",
-                          displayedMnemonic, mnemonic);
+        firePropertyChange("displayedMnemonic", displayedMnemonic, mnemonic);
        displayedMnemonic = mnemonic;
 
        if (text != null)
@@ -645,22 +646,33 @@
    * This method returns the keycode that is used for the label's mnemonic.
    *
    * @return The keycode that is used for the label's mnemonic.
+   * 
+   * @see #setDisplayedMnemonic(int)
    */
   public int getDisplayedMnemonic()
   {
-    return (int) displayedMnemonic;
+    return displayedMnemonic;
   }
 
   /**
-   * 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.
+   * Sets the index of the character in the text that will be underlined to
+   * indicate that it is the mnemonic character for the label.  You only need
+   * to call this method if you wish to override the automatically calculated
+   * character index.  For instance, for a label "Find Next" with the mnemonic
+   * character 'n', you might wish to underline the second occurrence of 'n'
+   * rather than the first (which is the default).
+   * <br><br>
+   * Note that this method does not validate the character at the specified 
+   * index to ensure that it matches the key code returned by
+   * address@hidden #getDisplayedMnemonic()}.
    *
    * @param newIndex The index of the character to underline.
    *
-   * @throws IllegalArgumentException If index less than -1 or index equals
-   *         length.
+   * @throws IllegalArgumentException If index less than -1 or index is greater
+   *         than or equal to the label length.
+   *         
+   * @see #getDisplayedMnemonicIndex()
+   * @since 1.4
    */
   public void setDisplayedMnemonicIndex(int newIndex)
     throws IllegalArgumentException
@@ -668,25 +680,23 @@
     if (newIndex < -1 || (text != null && newIndex >= text.length()))
       throw new IllegalArgumentException();
 
-    if (newIndex == -1
-        || text == null
-       || text.charAt(newIndex) != displayedMnemonic)
-      newIndex = -1;
-
     if (newIndex != displayedMnemonicIndex)
       {
        int oldIndex = displayedMnemonicIndex;
        displayedMnemonicIndex = newIndex;
-       firePropertyChange("displayedMnemonicIndex",
-                          oldIndex, newIndex);
+        firePropertyChange("displayedMnemonicIndex", oldIndex, newIndex);
       }
   }
 
   /**
-   * This method returns which character in the text will be  the underlined
-   * character.
+   * Returns the index of the character in the label's text that will be
+   * underlined (to indicate that it is the mnemonic character), or -1 if no
+   * character is to be underlined.
    *
    * @return The index of the character that will be underlined.
+   * 
+   * @see #setDisplayedMnemonicIndex(int)
+   * @since 1.4
    */
   public int getDisplayedMnemonicIndex()
   {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]