From ac1ed908de999523efc36f38e69bca1aadfe0808 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 14 Aug 2006 23:12:35 +0000 Subject: Imported GNU Classpath 0.92 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. From-SVN: r116139 --- libjava/classpath/javax/swing/ButtonGroup.java | 53 +++++++++++++++++--------- 1 file changed, 34 insertions(+), 19 deletions(-) (limited to 'libjava/classpath/javax/swing/ButtonGroup.java') diff --git a/libjava/classpath/javax/swing/ButtonGroup.java b/libjava/classpath/javax/swing/ButtonGroup.java index 2f8d198..efa36b5 100644 --- a/libjava/classpath/javax/swing/ButtonGroup.java +++ b/libjava/classpath/javax/swing/ButtonGroup.java @@ -1,5 +1,5 @@ /* ButtonGroup.java -- - Copyright (C) 2002 Free Software Foundation, Inc. + Copyright (C) 2002, 2006, Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -65,10 +65,9 @@ import java.util.Vector; */ public class ButtonGroup implements Serializable { - /** DOCUMENT ME! */ private static final long serialVersionUID = 4259076101881721375L; - /** The buttons added to this button group. */ + /** Stores references to the buttons added to this button group. */ protected Vector buttons = new Vector(); /** The currently selected button model. */ @@ -83,12 +82,20 @@ public class ButtonGroup implements Serializable } /** - * Adds a button to this group. + * Adds a button to this group. If the button is in the selected state, then: + * * - * @param b the button to add + * @param b the button to add (null is ignored). */ public void add(AbstractButton b) { + if (b == null) + return; b.getModel().setGroup(this); if (b.isSelected()) { @@ -96,17 +103,24 @@ public class ButtonGroup implements Serializable sel = b.getModel(); else b.setSelected(false); - } buttons.addElement(b); + } + buttons.addElement(b); } /** - * Removed a given button from this group. + * Removes the specified button from this group. If the button is the + * selected button, the current selection is set to null. + * The group for the removed button's model is set to null. * - * @param b the button to remove + * @param b the button to remove (null is ignored). */ public void remove(AbstractButton b) { + if (b == null) + return; b.getModel().setGroup(null); + if (b.getModel() == sel) + sel = null; buttons.removeElement(b); } @@ -132,19 +146,20 @@ public class ButtonGroup implements Serializable } /** - * DOCUMENT ME! + * Returns the button that has the specified model, or null if + * there is no such button in the group. * - * @param m DOCUMENT ME! + * @param m the button model. * - * @return DOCUMENT ME! + * @return The button that has the specified model, or null. */ - AbstractButton FindButton(ButtonModel m) + AbstractButton findButton(ButtonModel m) { for (int i = 0; i < buttons.size(); i++) { - AbstractButton a = (AbstractButton) buttons.get(i); - if (a.getModel() == m) - return a; + AbstractButton a = (AbstractButton) buttons.get(i); + if (a.getModel() == m) + return a; } return null; } @@ -168,7 +183,7 @@ public class ButtonGroup implements Serializable if (old != null) old.setSelected(false); - AbstractButton button = FindButton(old); + AbstractButton button = findButton(old); if (button != null) button.repaint(); } @@ -180,10 +195,10 @@ public class ButtonGroup implements Serializable * Checks if the given ButtonModel is selected in this button * group. * - * @param m DOCUMENT ME! + * @param m the button model (null permitted). * - * @return true of given ButtonModel is selected, false - * otherwise + * @return true if m is the selected button model + * in this group, and false otherwise. */ public boolean isSelected(ButtonModel m) { -- cgit v1.1