public class ChoiceItem<T> extends java.lang.Object implements java.lang.Comparable<ChoiceItem<T>>
FreeColChoiceDialog.| Modifier and Type | Field and Description |
|---|---|
private boolean |
enabled |
private javax.swing.ImageIcon |
icon |
private T |
object |
private boolean |
optionCancel |
private boolean |
optionDefault |
private boolean |
optionOK |
private java.lang.String |
text |
| Constructor and Description |
|---|
ChoiceItem(java.lang.String text,
T object)
Creates a new
ChoiceItem with the
given object. |
ChoiceItem(java.lang.String text,
T object,
boolean enable)
Creates a new
ChoiceItem with the
given object. |
ChoiceItem(T object)
Creates a new
ChoiceItem with the
given object. |
| Modifier and Type | Method and Description |
|---|---|
ChoiceItem<T> |
cancelOption()
Make this choice the "cancel" option.
|
int |
compareTo(ChoiceItem<T> other) |
ChoiceItem<T> |
defaultOption()
Make this choice the default.
|
int |
getChoice()
Gets the choice as an
int. |
javax.swing.ImageIcon |
getIcon()
Get any icon associated with this choice.
|
T |
getObject()
Gets the
Object contained by this choice. |
boolean |
isCancel()
Is this choice the "cancel" choice?
|
boolean |
isDefault()
Is this choice the default choice?
|
boolean |
isEnabled()
Should this item be enabled or not?
|
boolean |
isOK()
Is this choice the "OK" choice?
|
ChoiceItem<T> |
okOption()
Make this choice the "OK" option.
|
ChoiceItem<T> |
setIcon(javax.swing.ImageIcon icon)
Add an icon to this choice.
|
java.lang.String |
toString() |
private java.lang.String text
private final T object
private javax.swing.ImageIcon icon
private final boolean enabled
private boolean optionOK
private boolean optionCancel
private boolean optionDefault
public ChoiceItem(java.lang.String text,
T object,
boolean enable)
ChoiceItem with the
given object.text - The text that should be used to represent this choice.object - The object contained by this choice.enable - Sets if the option should be enabled or notpublic ChoiceItem(java.lang.String text,
T object)
ChoiceItem with the
given object.text - The text that should be used to represent this choice.object - The object contained by this choice.public ChoiceItem(T object)
ChoiceItem with the
given object.object - The object contained by this choice.public T getObject()
Object contained by this choice.Object.public int getChoice()
int.java.lang.ClassCastException - if the object is
not an Integer.public boolean isEnabled()
public java.lang.String toString()
toString in class java.lang.Objectpublic javax.swing.ImageIcon getIcon()
public ChoiceItem<T> setIcon(javax.swing.ImageIcon icon)
icon - The ImageIcon to add.public boolean isOK()
public ChoiceItem<T> okOption()
public boolean isCancel()
public ChoiceItem<T> cancelOption()
public boolean isDefault()
public ChoiceItem<T> defaultOption()
public int compareTo(ChoiceItem<T> other)
compareTo in interface java.lang.Comparable<ChoiceItem<T>>