Class ControlSwingElement
java.lang.Object
org.opensourcephysics.ejs.control.ControlElement
org.opensourcephysics.ejs.control.swing.ControlSwingElement
- Direct Known Subclasses:
ControlBar,ControlButton,ControlCheckBox,ControlComboBox,ControlContainer,ControlDrawablesParent,ControlInputArea,ControlLabel,ControlNumberField,ControlRadioButton,ControlSlider,ControlTextArea,ControlTextField
ControlSwingElement is a base class for an object that
displays a visual java.awt.Component.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intprotected Componentstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intFields inherited from class org.opensourcephysics.ejs.control.ControlElement
ACTION, isUnderEjs, METHOD_FOR_VARIABLE, METHOD_TRIGGER, myGroup, myObject, myPropertiesTable, VARIABLE_CHANGED -
Constructor Summary
ConstructorsConstructorDescriptionControlSwingElement(Object _visual) Instantiates an object that wrapps a Swing JComponent of this type. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract ComponentcreateVisual(Object _visual) Creates the visual component of thisControlElement, the one you can configure graphically.Returns the component of thisControlElement, the one that is added to a container.protected ImageIcongetPropertyInfo(String _property) Returns information about a given property.Returns the list of all properties that can be set for this ControlElement.getValue(int _index) Gets the value of any internal variable.final ComponentReturns the visual component of thisControlElement, the one you can configure graphically.parseConstant(String _propertyType, String _value) Checks if a value can be considered a valid constant value for a property If not, it returns null, meaning the value can be considered to be a GroupVariable or a primitive constant.voidsetDefaultValue(int _index) voidSets the value of the registered variables.Methods inherited from class org.opensourcephysics.ejs.control.ControlElement
addAction, addAction, addAction, destroy, getGroup, getObject, getProperty, getSimulation, implementsProperty, initialize, invokeActions, invokeActions, isActive, propertyIsTypeOf, propertyType, removeAction, removeAction, reset, setActive, setGroup, setProperties, setProperty, toString, variableChanged, variableChangedDoNotUpdate, variablePropertiesClear, variablesChanged
-
Field Details
-
NAME
public static final int NAME- See Also:
-
POSITION
public static final int POSITION- See Also:
-
PARENT
public static final int PARENT- See Also:
-
ENABLED
public static final int ENABLED- See Also:
-
VISIBLE
public static final int VISIBLE- See Also:
-
SIZE
public static final int SIZE- See Also:
-
FOREGROUND
public static final int FOREGROUND- See Also:
-
BACKGROUND
public static final int BACKGROUND- See Also:
-
FONT
public static final int FONT- See Also:
-
TOOLTIP
public static final int TOOLTIP- See Also:
-
ACTION_PRESS
public static final int ACTION_PRESS- See Also:
-
ACTION_ON
public static final int ACTION_ON- See Also:
-
ACTION_OFF
public static final int ACTION_OFF- See Also:
-
myVisual
-
-
Constructor Details
-
ControlSwingElement
Instantiates an object that wrapps a Swing JComponent of this type. If an object of an appropriate class is provided, it is used as the visual.- Parameters:
_visual- The javax.swing.JComponent to be wrapped
-
-
Method Details
-
createVisual
Creates the visual component of thisControlElement, the one you can configure graphically. If an object of an appropriate class is provided, it is used as the visual.- Parameters:
_visual- The javax.swing.JComponent to be wrapped
-
getVisual
Returns the visual component of thisControlElement, the one you can configure graphically.- Overrides:
getVisualin classControlElement
-
getComponent
Returns the component of thisControlElement, the one that is added to a container.- Overrides:
getComponentin classControlElement
-
getPropertyList
Returns the list of all properties that can be set for this ControlElement. Subclasses that add properties should extend this table. Order is crucial here: Both for the presentation in an editor (f.i. ViewElement) and for the setValue() method.- Specified by:
getPropertyListin classControlElement
-
getPropertyInfo
Returns information about a given property. Subclasses that add properties should extend this table.- The first keyword is ALWAYS the type.
- The keyword CONSTANT applies to properties that can not be changed using the setValue() methods
- The keyword BASIC is used by Ejs to group properties to the left hand side of the property editor
- The keyword HIDDEN is used by Ejs so that it does not display an entry in the editor field
- Specified by:
getPropertyInfoin classControlElement
-
parseConstant
Checks if a value can be considered a valid constant value for a property If not, it returns null, meaning the value can be considered to be a GroupVariable or a primitive constant. This method implements more cases than really needed for the base class. This is in order to save repetitions in swing subclasses.- Overrides:
parseConstantin classControlElement- Parameters:
String- _property The property nameString- _value The proposed value for the property
-
setValue
Sets the value of the registered variables. Subclasses with internal values should extend this- Overrides:
setValuein classControlElement- Parameters:
_index- A keyword index that distinguishes among variables_value- The object holding the value for the variable.
-
setDefaultValue
public void setDefaultValue(int _index) - Overrides:
setDefaultValuein classControlElement
-
getValue
Gets the value of any internal variable. Subclasses with internal values should extend this- Overrides:
getValuein classControlElement- Parameters:
_index- A keyword index that distinguishes among variables- Returns:
- Value _value The object holding the value for the variable.
-
getIcon
-