From ffde862e033a0825e1e9972a89c0f1f80b261a8e Mon Sep 17 00:00:00 2001 From: mark Date: Mon, 14 Aug 2006 23:12:35 +0000 Subject: 2006-08-14 Mark Wielaard Imported GNU Classpath 0.92 * HACKING: Add more importing hints. Update automake version requirement. * configure.ac (gconf-peer): New enable AC argument. Add --disable-gconf-peer and --enable-default-preferences-peer to classpath configure when gconf is disabled. * scripts/makemake.tcl: Set gnu/java/util/prefs/gconf and gnu/java/awt/dnd/peer/gtk to bc. Classify gnu/java/security/Configuration.java as generated source file. * gnu/java/lang/management/VMGarbageCollectorMXBeanImpl.java, gnu/java/lang/management/VMMemoryPoolMXBeanImpl.java, gnu/java/lang/management/VMClassLoadingMXBeanImpl.java, gnu/java/lang/management/VMRuntimeMXBeanImpl.java, gnu/java/lang/management/VMMemoryManagerMXBeanImpl.java, gnu/java/lang/management/VMThreadMXBeanImpl.java, gnu/java/lang/management/VMMemoryMXBeanImpl.java, gnu/java/lang/management/VMCompilationMXBeanImpl.java: New VM stub classes. * java/lang/management/VMManagementFactory.java: Likewise. * java/net/VMURLConnection.java: Likewise. * gnu/java/nio/VMChannel.java: Likewise. * java/lang/Thread.java (getState): Add stub implementation. * java/lang/Class.java (isEnum): Likewise. * java/lang/Class.h (isEnum): Likewise. * gnu/awt/xlib/XToolkit.java (getClasspathTextLayoutPeer): Removed. * javax/naming/spi/NamingManager.java: New override for StackWalker functionality. * configure, sources.am, Makefile.in, gcj/Makefile.in, include/Makefile.in, testsuite/Makefile.in: Regenerated. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@116139 138bc75d-0d04-0410-961f-82ee72b054a4 --- libjava/classpath/javax/swing/AbstractButton.java | 57 ++++++++++++++++------- 1 file changed, 41 insertions(+), 16 deletions(-) (limited to 'libjava/classpath/javax/swing/AbstractButton.java') diff --git a/libjava/classpath/javax/swing/AbstractButton.java b/libjava/classpath/javax/swing/AbstractButton.java index 9b2b526f30b..63f827a1ae0 100644 --- a/libjava/classpath/javax/swing/AbstractButton.java +++ b/libjava/classpath/javax/swing/AbstractButton.java @@ -199,7 +199,7 @@ public abstract class AbstractButton extends JComponent Icon pressed_icon; /** The icon displayed when the button is disabled. */ - Icon disabeldIcon; + Icon disabledIcon; /** The icon displayed when the button is selected. */ Icon selectedIcon; @@ -923,7 +923,7 @@ public abstract class AbstractButton extends JComponent // constructor). // This way the behavior of the JDK is matched. if(text != null) - this.text = text; + setText(text); if (icon != null) default_icon = icon; @@ -1297,9 +1297,11 @@ public abstract class AbstractButton extends JComponent * alignment is a numeric constant from {@link SwingConstants}. It must * be one of: RIGHT, LEFT, CENTER, * LEADING or TRAILING. The default is - * RIGHT. + * CENTER. * * @return The current horizontal alignment + * + * @see #setHorizontalAlignment(int) */ public int getHorizontalAlignment() { @@ -1311,17 +1313,21 @@ public abstract class AbstractButton extends JComponent * alignment is a numeric constant from {@link SwingConstants}. It must * be one of: RIGHT, LEFT, CENTER, * LEADING or TRAILING. The default is - * RIGHT. + * CENTER. * * @param a The new horizontal alignment * @throws IllegalArgumentException If alignment is not one of the legal * constants. + * + * @see #getHorizontalAlignment() */ public void setHorizontalAlignment(int a) { if (horizontalAlignment == a) return; - + if (a != LEFT && a != CENTER && a != RIGHT && a != LEADING + && a != TRAILING) + throw new IllegalArgumentException("Invalid alignment."); int old = horizontalAlignment; horizontalAlignment = a; firePropertyChange(HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, old, a); @@ -1358,6 +1364,9 @@ public abstract class AbstractButton extends JComponent { if (horizontalTextPosition == t) return; + if (t != LEFT && t != CENTER && t != RIGHT && t != LEADING + && t != TRAILING) + throw new IllegalArgumentException("Invalid alignment."); int old = horizontalTextPosition; horizontalTextPosition = t; @@ -1373,6 +1382,8 @@ public abstract class AbstractButton extends JComponent * BOTTOM. The default is CENTER. * * @return The current vertical alignment + * + * @see #setVerticalAlignment(int) */ public int getVerticalAlignment() { @@ -1388,12 +1399,16 @@ public abstract class AbstractButton extends JComponent * @param a The new vertical alignment * @throws IllegalArgumentException If alignment is not one of the legal * constants. + * + * @see #getVerticalAlignment() */ public void setVerticalAlignment(int a) { if (verticalAlignment == a) return; - + if (a != TOP && a != CENTER && a != BOTTOM) + throw new IllegalArgumentException("Invalid alignment."); + int old = verticalAlignment; verticalAlignment = a; firePropertyChange(VERTICAL_ALIGNMENT_CHANGED_PROPERTY, old, a); @@ -1430,6 +1445,8 @@ public abstract class AbstractButton extends JComponent { if (verticalTextPosition == t) return; + if (t != TOP && t != CENTER && t != BOTTOM) + throw new IllegalArgumentException("Invalid alignment."); int old = verticalTextPosition; verticalTextPosition = t; @@ -1708,14 +1725,14 @@ public abstract class AbstractButton extends JComponent */ public Icon getDisabledIcon() { - if (disabeldIcon == null && default_icon instanceof ImageIcon) + if (disabledIcon == null && default_icon instanceof ImageIcon) { Image iconImage = ((ImageIcon) default_icon).getImage(); Image grayImage = GrayFilter.createDisabledImage(iconImage); - disabeldIcon = new ImageIcon(grayImage); + disabledIcon = new ImageIcon(grayImage); } - return disabeldIcon; + return disabledIcon; } /** @@ -1729,7 +1746,11 @@ public abstract class AbstractButton extends JComponent */ public void setDisabledIcon(Icon d) { - disabeldIcon = d; + if (disabledIcon == d) + return; + Icon old = disabledIcon; + disabledIcon = d; + firePropertyChange(DISABLED_ICON_CHANGED_PROPERTY, old, d); revalidate(); repaint(); } @@ -2092,7 +2113,8 @@ public abstract class AbstractButton extends JComponent } /** - * Set the button's rollover icon. The look and feel class should + * Set the button's rollover icon and sets the rolloverEnabled + * property to true. The look and feel class should * paint this icon when the "rolloverEnabled" property of the button is * true and the mouse rolls over the button. * @@ -2106,6 +2128,7 @@ public abstract class AbstractButton extends JComponent Icon old = rolloverIcon; rolloverIcon = r; firePropertyChange(ROLLOVER_ICON_CHANGED_PROPERTY, old, rolloverIcon); + setRolloverEnabled(true); revalidate(); repaint(); } @@ -2124,12 +2147,13 @@ public abstract class AbstractButton extends JComponent } /** - * Set the button's rollover selected icon. The look and feel class - * should paint this icon when the "rolloverEnabled" property of the button - * is true, the "selected" property of the button's model is - * true, and the mouse rolls over the button. + * Set the button's rollover selected icon and sets the + * rolloverEnabled property to true. The look and + * feel class should paint this icon when the "rolloverEnabled" property of + * the button is true, the "selected" property of the button's + * model is true, and the mouse rolls over the button. * - * @param r The new rollover selected icon + * @param r The new rollover selected icon. */ public void setRolloverSelectedIcon(Icon r) { @@ -2139,6 +2163,7 @@ public abstract class AbstractButton extends JComponent Icon old = rolloverSelectedIcon; rolloverSelectedIcon = r; firePropertyChange(ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, old, r); + setRolloverEnabled(true); revalidate(); repaint(); } -- cgit v1.2.1