This was filed because it matches a similar JCK issue for Checkbox: 4632623
The ctor for java.awt.Button says
/**
* Constructs a Button with no label.
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
* returns true
* @see java.awt.GraphicsEnvironment#isHeadless
*/
public Button() throws HeadlessException {
this("");
}
"No label" is taken to mean that the value is null elsewhere in Button.java
and other classes. In fact, the label is the empty string, and we should
say so explicitly.
This ctor needs to be changed as well:
/**
* Constructs a Button with the specified label.
* @param label A string label for the button.
* @exception HeadlessException if GraphicsEnvironment.isHeadless()
* returns true
* @see java.awt.GraphicsEnvironment#isHeadless
*/
public Button(String label) throws HeadlessException {
GraphicsEnvironment.checkHeadless();
this.label = label;
}
It should say:
@param label a string label for the button, or <code>null</code> for no label
The field description needs to be fixed as well:
/*
* The button's Label.
* If the Label is not specified it will default to "".
* @serial
* @see getLabel()
* @see setLabel()
*/
We should remove the comment about the default, and simply state that this
value may be null.