public final class PuBoolean extends PsObject
Usage demonstrated in a sample class:
public class PjExprOde {
protected PuBoolean m_flag;
public PjExprOde() {
// Create a new instance of PuBoolean and register 'this' as update listener
// to receive update events whenever user has modified the inspector.
m_flag = new PuBoolean("Flag", this);
}
public void init() {
m_flag.setDefState(true); // Set default value.
m_flag.init(); // Initiate or reset to default values.
}
public boolean update(Object event) {
// Catch update events sent whenever user has modified inspector.
if (event == m_flag) {
solve(m_flag.getState()); // Do something application depended
return true;
}
}
}
HAS_BOUNDARY_PANEL, HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_LABEL_PANEL, HAS_MATERIAL_PANEL, HAS_TEXTURE_PANEL, HAS_VECTOR_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_FOCUSSED, IS_PICKED, IS_SELECTED, IS_USED, NUM_TAGS
Constructor and Description |
---|
PuBoolean(java.lang.String name)
Create new instance with given name.
|
PuBoolean(java.lang.String name,
PsUpdateIf parent)
Create new instance with given name and parent.
|
PuBoolean(java.lang.String name,
PsUpdateIf parent,
boolean defState)
Create new instance with given name, parent, and default state.
|
Modifier and Type | Method and Description |
---|---|
java.awt.Color |
getBackground()
Get color of background of info panel.
|
boolean |
getDefState()
Get the default state which is used when this object is reset.
|
boolean |
getState()
Get current boolean state.
|
void |
init()
Assign default state, and may be used to reset instance.
|
boolean |
isEnabled()
Check whether inspector is enabled or disabled.
|
void |
setBackground(java.awt.Color color)
Set color of background of info panel.
|
void |
setDefState(boolean state)
Set default state to be assigned when
init() is called as reset. |
void |
setEnabled(boolean flag)
Enable or disable the inspector for interactive use.
|
void |
setState(boolean state)
Set state of boolean.
|
addInspector, addUpdateListener, assureInspector, clearTag, clone, clone, clone, copy, getFather, getInfoPanel, getInspector, getName, getNumObjects, getSymbol, hasInspector, hasTag, hasUpdateListener, instanceOf, instanceOf, newInspector, newInspector, removeInspector, removeInspector, removeUpdateListener, setName, setParent, setSymbol, setTag, toString, update, updatePanels
public PuBoolean(java.lang.String name)
In order to receive update events of this inspector one might either assign a parent or register an update listener.
name
- Name of boolean to appear as label of checkbox.public PuBoolean(java.lang.String name, PsUpdateIf parent)
parent.update(this)
.name
- Name of boolean to appear as label in inspectorparent
- Parent of boolean to receive update events.public PuBoolean(java.lang.String name, PsUpdateIf parent, boolean defState)
parent.update(this)
.name
- Name of boolean to appear as label in inspectorparent
- Parent of boolean to receive update events.defState
- Default state of the checkbox.public void init()
public void setState(boolean state)
This routine called from outside to set the state. Only here we update the panel.
public boolean getState()
public boolean getDefState()
setDefState(boolean)
,
getState()
public void setDefState(boolean state)
init()
is called as reset.public boolean isEnabled()
public void setEnabled(boolean flag)
setState(boolean)
, and the inspector
is always updated.public java.awt.Color getBackground()
public void setBackground(java.awt.Color color)
"