public class MyClass extends PsObject
Any subclass of PsObject may have an associated info panel for inspecting
itself in an interactive panel. The info panel may either be supplied by a
superclass, or by providing a panel whose class name has appended '_IP' to
the name of the class which shall be inspected. In this tutorial, the base
class is MyClass and its panel is MyClass_IP. Invoking the method
getInfoPanel()
returns an instance of the panel, as done in
the main(String [])
, which can be inserted in a frame or in
other panels. In JavaView, the panel is usually added to the control window.
The base class and its panel communicate via the methods update(Object)
once the base class is registered in the panel as its parent. This registration
is done in the super class PsObject after the first call of getInfoPanel()
.
Base class and its panel separate the data and the widget user interface. The base class contains the data and is usually embedded in a program, while the panel contains the widget representation. The panel is just attached to the base class and only accessible through it.
If multiple instances of an info panel are needed then one should use the
method newInstance(PsPanel.INFO_EXT)
to obtain and register
new info panels. Advanced applications are advised to use this method.
PsObject
,
PsUpdateIf
,
Serialized FormHAS_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 |
---|
MyClass()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
getSelectedTopic() |
boolean |
getState() |
java.lang.String |
getText() |
java.lang.String[] |
getTopics() |
void |
init()
Set values of variables.
|
static void |
main(java.lang.String[] args)
Standalone application support.
|
void |
setSelectedTopic(int ind) |
void |
setState(boolean flag) |
void |
setText(java.lang.String text) |
boolean |
update(java.lang.Object event)
Update the class whenever a child has changed.
|
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, updatePanels
public void init()
public boolean update(java.lang.Object event)
update
in interface PsUpdateIf
update
in class PsObject
event
- carries a lot of informationPsObject.setParent(PsUpdateIf)
,
PsObject.getFather()
,
PsObject.addUpdateListener(PsUpdateIf)
public boolean getState()
public void setState(boolean flag)
public java.lang.String[] getTopics()
public int getSelectedTopic()
public void setSelectedTopic(int ind)
public java.lang.String getText()
public void setText(java.lang.String text)
public static void main(java.lang.String[] args)
"