FileDocCategorySizeDatePackage
Option.javaAPI DocJava SE 5 API2125Fri Aug 26 14:58:18 BST 2005javax.swing.text.html

Option

public class Option extends Object
Value for the ListModel used to represent <option> elements. This is the object installed as items of the DefaultComboBoxModel used to represent the <select> element.
author
Timothy Prinzing
version
1.10 12/19/03

Fields Summary
private boolean
selected
private String
label
private AttributeSet
attr
Constructors Summary
public Option(AttributeSet attr)
Creates a new Option object.

param
attr the attributes associated with the option element. The attributes are copied to ensure they won't change.

	this.attr = attr.copyAttributes();
	selected = (attr.getAttribute(HTML.Attribute.SELECTED) != null);
    
Methods Summary
public javax.swing.text.AttributeSetgetAttributes()
Fetch the attributes associated with this option.

	return attr;
    
public java.lang.StringgetLabel()
Fetch the label associated with the option.

	return label;
    
public java.lang.StringgetValue()
Convenience method to return the string associated with the value attribute. If the value has not been specified, the label will be returned.

	String value = (String) attr.getAttribute(HTML.Attribute.VALUE);
	if (value == null) {
	    value = label;
	}
	return value;
    
public booleanisSelected()
Fetches the selection state associated with this option.

	return selected;
    
public voidsetLabel(java.lang.String label)
Sets the label to be used for the option.

	this.label = label;
    
protected voidsetSelection(boolean state)
Sets the selected state.

	selected = state;
    
public java.lang.StringtoString()
String representation is the label.

	return label;