Class Panel
- All Implemented Interfaces:
HasLocalTransform
,CloneableSmartAsset
,Collidable
,Savable
,JmeCloneable
,Cloneable
- Direct Known Subclasses:
ColorChooser
,Container
,GridPanel
,Label
,ListBox
,NLoadingSpinner
,NVSpacer
,OptionPanel
,ProgressBar
,RollupPanel
,Selector
,Slider
,Spinner
,TabbedPanel
,TextField
"Panels" are often thought about in 2D terms but the Lemur default Panel is not limited to 2D. It's behavior depends entirely on the background component, which could be a simple 2D quad using a QuadComponent or something more complicated that is fully 3D.
By default, Lemur GUI elements are setup so that their local translation determines the position of their top-left corner in x/y space. In other words, the y-axis acts a little differently than other axes in that it grows down instead of up. Within an element, the coordinate system is still the standard JME coordinate system. It's just how the elements are are arranged relative to their own local translation that is different. This makes multi-element layouts more sensible or consistent with other GUI libraries.
Note: the layout code currently assumes that rotation and scale are their default values.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.jme3.scene.Spatial
Spatial.BatchHint, Spatial.CullHint, Spatial.DFSMode
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
static final String
static final String
static final String
static final String
static final String
Fields inherited from class com.jme3.scene.Spatial
batchHint, controls, cullHint, frustrumIntersects, key, localLights, localOverrides, localTransform, name, parent, queueBucket, queueDistance, refreshFlags, RF_BOUND, RF_CHILD_LIGHTLIST, RF_LIGHTLIST, RF_MATPARAM_OVERRIDE, RF_TRANSFORM, shadowMode, userData, worldBound, worldLights, worldOverrides, worldTransform
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds the specified effect to this GUI element.void
float
getAlpha()
Returns an estimate of the current alpha multiplier for the child components.protected EffectControl
<Panel> Provides convenient access to the EffectControl...Returns a read-only view of the entire map of effects for this GUI element.getSize()
getStyle()
boolean
Returns true if this GUI element has the specified effect configured.static void
removeEffect
(String effectName) Removes a previously registered effect if it exists.void
boolean
Runs the specified effect if configured for this GUI element.void
setAlpha
(float alpha) Sets the alpha multiplier for all ColoredComponents in this panels component stack, including things like QuadBackgroundComponent, TextComponent, etc..void
setAlpha
(float alpha, boolean recursive) Sets the alpha multiplier for all ColoredComponents in this panels component stack, including things like QuadBackgroundComponent, TextComponent, etc..void
void
protected void
setChildAlpha
(Spatial child, float alpha) void
setEffects
(Map<String, Effect<? super Panel>> map) Adds multiple effects at once through a stylable attribute.void
void
void
setPreferredSize
(Vector3f size) void
toString()
Returns the Spatial's name followed by the class of the spatial
Example: "MyNode (com.jme3.scene.Spatial)"Methods inherited from class com.jme3.scene.Node
attachChild, attachChildAt, breadthFirstTraversal, clone, cloneFields, collideWith, deepClone, depthFirstTraversal, descendantMatches, descendantMatches, descendantMatches, detachAllChildren, detachChild, detachChildAt, detachChildNamed, getChild, getChild, getChildIndex, getChildren, getQuantity, getTriangleCount, getVertexCount, hasChild, oldDeepClone, read, setLightListRefresh, setLodLevel, setMaterial, setMatParamOverrideRefresh, setModelBound, setParent, setTransformRefresh, swapChildren, updateGeometricState, updateLogicalState, updateModelBound, updateWorldBound, write
Methods inherited from class com.jme3.scene.Spatial
addControl, addControlAt, addLight, addMatParamOverride, breadthFirstTraversal, center, checkCulling, clearMatParamOverrides, clone, depthFirstTraversal, forceRefresh, getBatchHint, getControl, getControl, getCullHint, getKey, getLastFrustumIntersection, getLocalBatchHint, getLocalCullHint, getLocalLightList, getLocalMatParamOverrides, getLocalQueueBucket, getLocalRotation, getLocalScale, getLocalShadowMode, getLocalToWorldMatrix, getLocalTransform, getLocalTranslation, getName, getNumControls, getParent, getQueueBucket, getShadowMode, getUserData, getUserDataKeys, getWorldBound, getWorldLightList, getWorldMatParamOverrides, getWorldRotation, getWorldScale, getWorldTransform, getWorldTranslation, hasAncestor, jmeClone, localToWorld, lookAt, matches, move, move, oldClone, removeControl, removeControl, removeFromParent, removeLight, removeMatParamOverride, rotate, rotate, rotateUpTo, runControlRender, scale, scale, setBatchHint, setBoundRefresh, setCullHint, setKey, setLastFrustumIntersection, setLocalRotation, setLocalRotation, setLocalScale, setLocalScale, setLocalScale, setLocalTransform, setLocalTranslation, setLocalTranslation, setName, setQueueBucket, setRequiresUpdates, setShadowMode, setUserData, updateMatParamOverrides, updateWorldLightList, updateWorldTransforms, worldToLocal
-
Field Details
-
ELEMENT_ID
- See Also:
-
LAYER_BACKGROUND
- See Also:
-
LAYER_INSETS
- See Also:
-
LAYER_BORDER
- See Also:
-
EFFECT_OPEN
- See Also:
-
EFFECT_CLOSE
- See Also:
-
-
Constructor Details
-
Panel
public Panel() -
Panel
-
Panel
-
Panel
-
Panel
public Panel(float width, float height) -
Panel
-
Panel
-
Panel
-
Panel
-
Panel
-
Panel
This is the constructure that subclasses should call as it allows them to bypass the default style application and apply styles themselves. In many cases, the default style processing will be fine but occasionally the subclasses may need to do some processing before style application. For example, if constructor paramaters will setup some components that a style would also define then it can create needless churn during construction if the styles are applied first. (Note: in reality, currently existing values are not checked during style application even though the design is that they should be. A solution for primitive values is still needed for this to work. FIXME) Subclasses that also want to be extension-friendly should consider providing a similar protected constructor.
-
-
Method Details
-
getElementId
-
getStyle
-
setSize
-
getSize
-
setPreferredSize
@StyleAttribute(value="preferredSize", lookupDefault=false) public void setPreferredSize(Vector3f size) -
getPreferredSize
-
addMouseListener
-
removeMouseListener
-
initializeDefaultStyles
-
setBackground
-
getBackground
-
setBorder
-
getBorder
-
setInsets
-
getInsets
-
setInsetsComponent
@StyleAttribute(value="insetsComponent", lookupDefault=false) public void setInsetsComponent(InsetsComponent ic) -
getInsetsComponent
-
setAlpha
Sets the alpha multiplier for all ColoredComponents in this panels component stack, including things like QuadBackgroundComponent, TextComponent, etc.. This can be used to generally fade a GUI element in or out as needed as long as its visuals are ColoredComponent compliant. -
setAlpha
public void setAlpha(float alpha, boolean recursive) Sets the alpha multiplier for all ColoredComponents in this panels component stack, including things like QuadBackgroundComponent, TextComponent, etc.. This can be used to generally fade a GUI element in or out as needed as long as its visuals are ColoredComponent compliant. If recursive is true then all child Spatials will also be checked and have their alpha set, and their children, and so on. -
setChildAlpha
-
getAlpha
public float getAlpha()Returns an estimate of the current alpha multiplier for the child components. It scans the component children and returns the first alpha value found. -
getEffectControl
Provides convenient access to the EffectControl... that also hides the Java-generic voodoo necessary to get it without an unchecked warning. -
runEffect
Runs the specified effect if configured for this GUI element. If the effect referenced is on a channel that already has a running effect then that effect will be canceled and the new effect will be fastforwarded proportionally. This is to help facilitate reciprocal effects like open/close or activate/deactivate the undo one another and therefore if the previous effect is still running there may be less to do. This logic only happens if the effect has specified a channel. Otherwise all effects are run independently.- Returns:
- True if the effect existed and was run. False if no effect was found.
-
addEffect
Adds the specified effect to this GUI element. Later calls to runEffect() will then be able to execute this effect. -
removeEffect
Removes a previously registered effect if it exists. Returns the removed effect if it existed. -
hasEffect
Returns true if this GUI element has the specified effect configured. -
setEffects
@StyleAttribute(value="effects", lookupDefault=false) public void setEffects(Map<String, Effect<? super Panel>> map) Adds multiple effects at once through a stylable attribute. -
getEffects
Returns a read-only view of the entire map of effects for this GUI element. -
toString
Description copied from class:Spatial
Returns the Spatial's name followed by the class of the spatial
Example: "MyNode (com.jme3.scene.Spatial)"
-