summaryrefslogtreecommitdiff
path: root/javax/swing/JButton.java
diff options
context:
space:
mode:
Diffstat (limited to 'javax/swing/JButton.java')
-rw-r--r--javax/swing/JButton.java66
1 files changed, 59 insertions, 7 deletions
diff --git a/javax/swing/JButton.java b/javax/swing/JButton.java
index c1340bbc2..787adb87c 100644
--- a/javax/swing/JButton.java
+++ b/javax/swing/JButton.java
@@ -1,5 +1,5 @@
/* JButton.java --
- Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005, 2006, Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -78,27 +78,57 @@ public class JButton extends AbstractButton
*/
private boolean defaultCapable;
+ /**
+ * Creates a new button with an empty string for the button text and no
+ * icon.
+ */
public JButton()
{
this(null, null);
}
+ /**
+ * Creates a new button from the specified action.
+ *
+ * @param a the action (<code>null</code> permitted).
+ *
+ * @see AbstractButton#setAction(Action)
+ */
public JButton(Action a)
{
this();
setAction(a);
}
+ /**
+ * Creates a new button with the specified icon (and an empty string for
+ * the button text).
+ *
+ * @param icon the icon (<code>null</code> permitted).
+ */
public JButton(Icon icon)
{
this(null, icon);
}
+ /**
+ * Creates a new button with the specified text and no icon.
+ *
+ * @param text the button text (<code>null</code> permitted, will be
+ * substituted by an empty string).
+ */
public JButton(String text)
{
this(text, null);
}
+ /**
+ * Creates a new button with the specified text and icon.
+ *
+ * @param text the button text (<code>null</code> permitted, will be
+ * substituted by an empty string).
+ * @param icon the icon (<code>null</code> permitted).
+ */
public JButton(String text, Icon icon)
{
super();
@@ -108,12 +138,16 @@ public class JButton extends AbstractButton
}
protected void configurePropertiesFromAction(Action a)
- {
- // Factory method which sets the AbstractButton's properties according to
- // values from the Action instance.
+ {
super.configurePropertiesFromAction(a);
}
+ /**
+ * Returns the object that provides accessibility features for this
+ * <code>JButton</code> component.
+ *
+ * @return The accessible context (an instance of {@link AccessibleJButton}).
+ */
public AccessibleContext getAccessibleContext()
{
if (accessibleContext == null)
@@ -121,6 +155,13 @@ public class JButton extends AbstractButton
return accessibleContext;
}
+ /**
+ * Returns the suffix (<code>"ButtonUI"</code> in this case) used to
+ * determine the class name for a UI delegate that can provide the look and
+ * feel for a <code>JButton</code>.
+ *
+ * @return <code>"ButtonUI"</code>.
+ */
public String getUIClassID()
{
// Returns a string that specifies the name of the L&F class that renders
@@ -138,7 +179,7 @@ public class JButton extends AbstractButton
* its <code>JRootPane</code>
*
* @see #isDefaultCapable()
- * @see #setDefaultCapable()
+ * @see #setDefaultCapable(boolean)
* @see JRootPane#getDefaultButton()
* @see JRootPane#setDefaultButton(JButton)
*/
@@ -160,7 +201,7 @@ public class JButton extends AbstractButton
*
* @return <code>true</code> if this button can act as the default button
*
- * @see #setDefaultCapable()
+ * @see #setDefaultCapable(boolean)
* @see #isDefaultButton()
* @see JRootPane#getDefaultButton()
* @see JRootPane#setDefaultButton(JButton)
@@ -172,6 +213,13 @@ public class JButton extends AbstractButton
return defaultCapable;
}
+ /**
+ * Returns an implementation-dependent string describing the attributes of
+ * this <code>JButton</code>.
+ *
+ * @return A string describing the attributes of this <code>JButton</code>
+ * (never <code>null</code>).
+ */
protected String paramString()
{
String superParam = super.paramString();
@@ -205,7 +253,7 @@ public class JButton extends AbstractButton
* @param defaultCapable <code>true</code> if this button can become the
* default button in its JRootPane, <code>false</code> otherwise
*
- * @see #setDefaultCapable()
+ * @see #setDefaultCapable(boolean)
* @see #isDefaultButton()
* @see JRootPane#getDefaultButton()
* @see JRootPane#setDefaultButton(JButton)
@@ -215,6 +263,10 @@ public class JButton extends AbstractButton
this.defaultCapable = defaultCapable;
}
+ /**
+ * Sets this button's UI delegate to the default (obtained from the
+ * {@link UIManager}) for the current look and feel.
+ */
public void updateUI()
{
setUI((ButtonUI) UIManager.getUI(this));