[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[cp-patches] FYI: AbstractButton text fix
From: |
Robert Schuster |
Subject: |
[cp-patches] FYI: AbstractButton text fix |
Date: |
Fri, 15 Jul 2005 15:10:00 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; de-AT; rv:1.7.8) Gecko/20050514 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
if an AbstractButton subclass is instantiated with a label (implicitly
or explicitly) being null (eg. new JButton() or new JButton((String)
null)) the button's label should be predefined to the empty string.
At least this is the JDK's behavior and with this patch we match it.
2005-07-15 Robert Schuster <address@hidden>
* javax/swing/AbstractButton.java:
(init): Do not change field text if argument text is null.
cu
Robert
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFC17WoG9cfwmwwEtoRAnXlAJ9WKRB6uGoEcMOq+RLzWuyX0kqavgCghxMk
0DgIZxIA0EqLXUTmaYkZMZM=
=AGyS
-----END PGP SIGNATURE-----
Index: javax/swing/AbstractButton.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/AbstractButton.java,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- javax/swing/AbstractButton.java 15 Jul 2005 11:41:06 -0000 1.38
+++ javax/swing/AbstractButton.java 15 Jul 2005 12:57:38 -0000 1.39
@@ -564,7 +564,13 @@
protected void init(String text, Icon icon)
{
- this.text = text;
+ // If text is null, we fall back to the empty
+ // string (which is set using AbstractButton's
+ // constructor).
+ // This way the behavior of the JDK is matched.
+ if(text != null)
+ this.text = text;
+
default_icon = icon;
actionListener = createActionListener();
changeListener = createChangeListener();
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [cp-patches] FYI: AbstractButton text fix,
Robert Schuster <=