/[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.12.2.2 by gnu_andrew, Sat Jan 15 17:02:20 2005 UTC revision 1.12.2.3 by gnu_andrew, Sun Jan 16 15:15:13 2005 UTC
# Line 372  public class JLabel extends JComponent i Line 372  public class JLabel extends JComponent i
372          displayedMnemonic = mnemonic;          displayedMnemonic = mnemonic;
373    
374          if (text != null)          if (text != null)
375            setDisplayedMnemonicIndex(text.indexOf(mnemonic));            setDisplayedMnemonicIndex(text.toUpperCase().indexOf(mnemonic));
376        }        }
377    }    }
378    
# 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    
# Line 523  public class JLabel extends JComponent i Line 526  public class JLabel extends JComponent i
526     */     */
527    public void setVerticalAlignment(int alignment)    public void setVerticalAlignment(int alignment)
528    {    {
529      if (alignment != verticalAlignment)      if (alignment == verticalAlignment)
530        {        return;
531          int oldAlignment = verticalAlignment;  
532          verticalAlignment = checkVerticalKey(alignment, "verticalAlignment");      int oldAlignment = verticalAlignment;
533          firePropertyChange(VERTICAL_ALIGNMENT_CHANGED_PROPERTY, oldAlignment,      verticalAlignment = checkVerticalKey(alignment, "verticalAlignment");
534                             verticalAlignment);      firePropertyChange(VERTICAL_ALIGNMENT_CHANGED_PROPERTY,
535        }                         oldAlignment, verticalAlignment);
536    }    }
537    
538    /**    /**
# Line 550  public class JLabel extends JComponent i Line 553  public class JLabel extends JComponent i
553     */     */
554    public void setHorizontalAlignment(int alignment)    public void setHorizontalAlignment(int alignment)
555    {    {
556        if (horizontalAlignment == alignment)
557          return;
558        
559      int oldAlignment = horizontalAlignment;      int oldAlignment = horizontalAlignment;
560      horizontalAlignment = checkHorizontalKey(alignment, "horizontalAlignment");      horizontalAlignment = checkHorizontalKey(alignment, "horizontalAlignment");
561      firePropertyChange(HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, oldAlignment,      firePropertyChange(HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, oldAlignment,

Legend:
Removed from v.1.12.2.2  
changed lines
  Added in v.1.12.2.3

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