/[classpath]/classpath/javax/swing/JLabel.java
ViewVC logotype

Diff of /classpath/javax/swing/JLabel.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.17 by mkoch, Mon Dec 6 17:01:55 2004 UTC revision 1.18 by mkoch, Tue Dec 21 21:21:00 2004 UTC
# Line 385  public class JLabel extends JComponent i Line 385  public class JLabel extends JComponent i
385     */     */
386    public void setDisplayedMnemonic(char mnemonic)    public void setDisplayedMnemonic(char mnemonic)
387    {    {
388      setDisplayedMnemonic((int) mnemonic);      setDisplayedMnemonic((int) Character.toUpperCase(mnemonic));
389    }    }
390    
391    /**    /**
# Line 399  public class JLabel extends JComponent i Line 399  public class JLabel extends JComponent i
399    }    }
400    
401    /**    /**
402     * This method sets which character in the text will be  the underlined     * This method sets which character in the text will be the underlined
403     * character. If the given index is -1, then this indicates  that there is     * character. If the given index is -1, then this indicates  that there is
404     * no mnemonic. If the index is less than -1 or if the index is equal to     * no mnemonic. If the index is less than -1 or if the index is equal to
405     * the length, this method will throw an IllegalArgumentException.     * the length, this method will throw an IllegalArgumentException.
# Line 410  public class JLabel extends JComponent i Line 410  public class JLabel extends JComponent i
410     *         length.     *         length.
411     */     */
412    public void setDisplayedMnemonicIndex(int newIndex)    public void setDisplayedMnemonicIndex(int newIndex)
413                                   throws IllegalArgumentException      throws IllegalArgumentException
414    {    {
415      if (newIndex < -1 || (text != null && newIndex >= text.length()))      if (newIndex < -1 || (text != null && newIndex >= text.length()))
416        throw new IllegalArgumentException();        throw new IllegalArgumentException();
417    
418      if (text == null || text.charAt(newIndex) != displayedMnemonic)      if (newIndex == -1
419            || text == null
420            || text.charAt(newIndex) != displayedMnemonic)
421        newIndex = -1;        newIndex = -1;
422    
423      if (newIndex != displayedMnemonicIndex)      if (newIndex != displayedMnemonicIndex)
424        {        {
425          firePropertyChange(DISPLAYED_MNEMONIC_INDEX_CHANGED_PROPERTY,          int oldIndex = displayedMnemonicIndex;
                            displayedMnemonicIndex, newIndex);  
426          displayedMnemonicIndex = newIndex;          displayedMnemonicIndex = newIndex;
427            firePropertyChange(DISPLAYED_MNEMONIC_INDEX_CHANGED_PROPERTY,
428                               oldIndex, newIndex);
429        }        }
430    }    }
431    

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.18

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26