public class JTreeCellData
extends java.lang.Object
implements java.lang.Comparable
JTreeCellRenderer
.Modifier and Type | Field and Description |
---|---|
protected TriStateBoolean |
_checkBoxState
If there is a check box, this variable reports its state.
|
protected boolean |
_hasCheckBox
If
true , then the cell renderer should include a checkbox;
if false then no checkbox. |
protected boolean |
_hasRadioButton
If
true , then the cell renderer should include a radio
button; if false then no radio button. |
protected int |
_heightAdj
Used to adjust the height of an individual node.
|
protected javax.swing.Icon |
_icon
The icon shown with the text.
|
protected boolean |
_isArmed
If
true , indicates that the check box is partially
committed. |
protected boolean |
_isCheckBoxEnabled
This should be
true if the tree node's checkbox should
have a visual appearance of being enabled. |
protected boolean |
_isCheckBoxSelectable
This should be
true if the tree node's checkbox is
selectable (i.e. |
protected boolean |
_isPressed
If
true , indicates that the check box should be rendered
as being pressed down. |
protected boolean |
_isRadioButtonEnabled
This should be
true if the tree node's radio button should
have a visual appearance of being enabled. |
protected boolean |
_isRadioButtonSelected
This should be
true if the tree node's radio button should
have a visual appearance of being selected. |
protected boolean |
_isTextEnabled
This should be
true if the tree node's text is drawn
as enabled; false otherwise. |
protected boolean |
_isTextSelectable
This should be
true if the tree node's text is selectable;
false otherwise. |
protected java.lang.String |
_text
The string label that is shown in the tree.
|
protected java.lang.String |
_toolTipText
The tooltip to show in the tree.
|
protected boolean |
_useDefaultIcons
If
true , then it instructs the cell renderer to use the
default icons in the tree instead of any explicitly specified icons. |
protected java.lang.Object |
_userObject
Can be used to hold additional user information.
|
Constructor and Description |
---|
JTreeCellData(javax.swing.Icon icon,
java.lang.String text)
A
JTreeCellData with only an icon and a text label; there
is no checkbox. |
JTreeCellData(javax.swing.Icon icon,
java.lang.String text,
boolean hasCheckBox)
A
JTreeCellData with an icon, text label, and checkbox
whose state is initially TriStateBoolean.FALSE . |
JTreeCellData(javax.swing.Icon icon,
java.lang.String text,
boolean hasCheckBox,
TriStateBoolean checkBoxState) |
JTreeCellData(java.lang.String text)
A
JTreeCellData with only a text label; there is no icon
or checkbox. |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(JTreeCellData otherData) |
int |
compareTo(java.lang.Object object) |
TriStateBoolean |
getCheckBoxState() |
boolean |
getHasCheckBox() |
boolean |
getHasRadioButton() |
int |
getHeightAdjustment() |
javax.swing.Icon |
getIcon() |
java.lang.String |
getText() |
java.lang.String |
getToolTipText() |
boolean |
getUseDefaultIcons() |
java.lang.Object |
getUserObject() |
boolean |
isArmed() |
boolean |
isCheckBoxEnabled() |
boolean |
isCheckBoxSelectable() |
boolean |
isEnabled()
Convenience method.
|
boolean |
isPressed() |
boolean |
isRadioButtonEnabled() |
boolean |
isRadioButtonSelected() |
boolean |
isTextEnabled() |
boolean |
isTextSelectable() |
void |
setArmed(boolean isArmed) |
void |
setCheckBoxEnabled(boolean isCheckBoxEnabled) |
void |
setCheckBoxSelectable(boolean isCheckBoxSelectable) |
void |
setCheckBoxState(boolean checkBoxState)
Convenience method.
|
void |
setCheckBoxState(TriStateBoolean checkBoxState) |
void |
setEnabled(boolean isEnabled)
Convenience method.
|
void |
setEnabled(boolean isEnabled,
boolean isTextSelectable)
Convenience method.
|
void |
setHasCheckBox(boolean hasCheckBox) |
void |
setHasRadioButton(boolean hasRadioButton)
Set radio button for this item.
|
void |
setHeightAdjustment(int heightAdj) |
void |
setIcon(javax.swing.Icon icon) |
void |
setPressed(boolean isPressed) |
void |
setRadioButtonEnabled(boolean enabled) |
void |
setRadioButtonSelected(boolean selected) |
void |
setText(java.lang.String text) |
void |
setTextEnabled(boolean isTextEnabled) |
void |
setTextSelectable(boolean isTextSelectable) |
void |
setToolTipText(java.lang.String toolTipText) |
void |
setUseDefaultIcons(boolean useDefaultIcons) |
void |
setUserObject(java.lang.Object userObject) |
java.lang.String |
toString() |
protected java.lang.String _text
protected boolean _isTextEnabled
true
if the tree node's text is drawn
as enabled; false
otherwise.protected boolean _isTextSelectable
true
if the tree node's text is selectable;
false
otherwise. Usually, you should allow the text
to be selected even if the label itself is disabled. This at least
lets the user know that the selection is acknowledged, but no action
is permitted.protected java.lang.String _toolTipText
protected javax.swing.Icon _icon
null
, no icon is
shown.protected boolean _useDefaultIcons
true
, then it instructs the cell renderer to use the
default icons in the tree instead of any explicitly specified icons.
Explicitly specified icons do not override this setting because
a null
for _icon
actually means no icon.protected boolean _hasCheckBox
true
, then the cell renderer should include a checkbox;
if false
then no checkbox. The checkbox is automatically
a tri-state checkbox. To set the checkbox to the third state, call
setCheckBoxState(null)
.protected boolean _hasRadioButton
true
, then the cell renderer should include a radio
button; if false
then no radio button.protected boolean _isRadioButtonEnabled
true
if the tree node's radio button should
have a visual appearance of being enabled.protected boolean _isRadioButtonSelected
true
if the tree node's radio button should
have a visual appearance of being selected.protected TriStateBoolean _checkBoxState
protected boolean _isCheckBoxEnabled
true
if the tree node's checkbox should
have a visual appearance of being enabled.protected boolean _isCheckBoxSelectable
true
if the tree node's checkbox is
selectable (i.e. if it can be toggled). If false
, any
attempt to change the checkbox should be ignored.protected boolean _isArmed
true
, indicates that the check box is partially
committed.protected boolean _isPressed
true
, indicates that the check box should be rendered
as being pressed down.protected java.lang.Object _userObject
protected int _heightAdj
public JTreeCellData(java.lang.String text)
JTreeCellData
with only a text label; there is no icon
or checkbox.public JTreeCellData(javax.swing.Icon icon, java.lang.String text)
JTreeCellData
with only an icon and a text label; there
is no checkbox.public JTreeCellData(javax.swing.Icon icon, java.lang.String text, boolean hasCheckBox)
JTreeCellData
with an icon, text label, and checkbox
whose state is initially TriStateBoolean.FALSE
.public JTreeCellData(javax.swing.Icon icon, java.lang.String text, boolean hasCheckBox, TriStateBoolean checkBoxState)
public int compareTo(java.lang.Object object)
compareTo
in interface java.lang.Comparable
public int compareTo(JTreeCellData otherData)
public void setEnabled(boolean isEnabled)
public void setEnabled(boolean isEnabled, boolean isTextSelectable)
public boolean isEnabled()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getText()
public void setText(java.lang.String text)
public boolean isTextEnabled()
public void setTextEnabled(boolean isTextEnabled)
public boolean isTextSelectable()
public void setTextSelectable(boolean isTextSelectable)
public java.lang.String getToolTipText()
public void setToolTipText(java.lang.String toolTipText)
public javax.swing.Icon getIcon()
public void setIcon(javax.swing.Icon icon)
public boolean getUseDefaultIcons()
public void setUseDefaultIcons(boolean useDefaultIcons)
public boolean getHasCheckBox()
public void setHasCheckBox(boolean hasCheckBox)
public boolean getHasRadioButton()
public void setRadioButtonEnabled(boolean enabled)
public void setRadioButtonSelected(boolean selected)
public boolean isRadioButtonEnabled()
public boolean isRadioButtonSelected()
public void setHasRadioButton(boolean hasRadioButton) throws java.lang.IllegalStateException
java.lang.IllegalStateException
- throw if check box setpublic TriStateBoolean getCheckBoxState()
public void setCheckBoxState(TriStateBoolean checkBoxState)
public void setCheckBoxState(boolean checkBoxState)
public boolean isCheckBoxEnabled()
public void setCheckBoxEnabled(boolean isCheckBoxEnabled)
public boolean isCheckBoxSelectable()
public void setCheckBoxSelectable(boolean isCheckBoxSelectable)
public boolean isArmed()
public void setArmed(boolean isArmed)
public boolean isPressed()
public void setPressed(boolean isPressed)
public java.lang.Object getUserObject()
public void setUserObject(java.lang.Object userObject)
public int getHeightAdjustment()
public void setHeightAdjustment(int heightAdj)