javax.swing.text.html

Class Option

public class Option extends Object

Value class for the combobox model that renders <option> elements.
Constructor Summary
Option(AttributeSet attr)
Creates a new Option instance that uses the specified tag attributes.
Method Summary
AttributeSetgetAttributes()
Returns the attributes used to render this <option> tag.
StringgetLabel()
Returns the label of this <option> tag.
StringgetValue()
Returns the string associated with the value attribute or the label, if no such attribute is specified.
booleanisSelected()
Returns true when this option is selected, false otherwise.
voidsetLabel(String l)
Sets the label to use for this <option> tag.
protected voidsetSelection(boolean s)
Sets the selected state of this <option> tag.
StringtoString()
Returns a string representation of this <option> tag.

Constructor Detail

Option

public Option(AttributeSet attr)
Creates a new Option instance that uses the specified tag attributes.

Parameters: attr the attributes to use

Method Detail

getAttributes

public AttributeSet getAttributes()
Returns the attributes used to render this <option> tag.

Returns: the attributes used to render this <option> tag

getLabel

public String getLabel()
Returns the label of this <option> tag.

Returns: the label of this <option> tag

getValue

public String getValue()
Returns the string associated with the value attribute or the label, if no such attribute is specified.

Returns: the string associated with the value attribute or the label, if no such attribute is specified

isSelected

public boolean isSelected()
Returns true when this option is selected, false otherwise.

Returns: true when this option is selected, false otherwise

setLabel

public void setLabel(String l)
Sets the label to use for this <option> tag.

Parameters: l the label to set

setSelection

protected void setSelection(boolean s)
Sets the selected state of this <option> tag.

Parameters: s the selected state to set

toString

public String toString()
Returns a string representation of this <option> tag. This returns the label property.

Returns: a string representation of this <option> tag