Package com.jme3.app.state
Class AWTComponentAppState
java.lang.Object
com.jme3.app.state.AbstractAppState
com.jme3.app.state.AWTComponentAppState
- All Implemented Interfaces:
AppState
An app state dedicated to the rendering of a JMonkey application within an AWT component.
-
Field Summary
Fields inherited from class com.jme3.app.state.AbstractAppState
initialized
-
Constructor Summary
ConstructorDescriptionAWTComponentAppState
(Component component) Create a new app state dedicated to the rendering of a JMonkey application within the given AWTcomponent
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
cleanup()
Called byAppStateManager
when transitioning thisAppState
from terminating to detached.Get the AWT component that is used as rendering output.Get thetransfer mode
that is used by the underlying frame processor.void
initialize
(AppStateManager stateManager, Application app) Called byAppStateManager
when transitioning thisAppState
from initializing to running.
This will happen on the next iteration through the update loop afterAppStateManager.attach(com.jme3.app.state.AppState)
was called.void
setComponent
(Component component) Set the AWT component that is used as rendering output.void
setEnabled
(boolean enabled) Enable or disable the functionality of theAppState
.void
Set thetransfer mode
that is used by the underlying frame processor.void
stateAttached
(AppStateManager stateManager) Called byAppStateManager.attach(com.jme3.app.state.AppState)
when transitioning thisAppState
from detached to initializing.void
update
(float tpf) Called to update theAppState
.Methods inherited from class com.jme3.app.state.AbstractAppState
getId, isEnabled, isInitialized, postRender, render, setId, stateDetached
-
Constructor Details
-
AWTComponentAppState
Create a new app state dedicated to the rendering of a JMonkey application within the given AWTcomponent
.- Parameters:
component
- the component that is used as rendering output.
-
-
Method Details
-
initialize
Description copied from interface:AppState
Called byAppStateManager
when transitioning thisAppState
from initializing to running.
This will happen on the next iteration through the update loop afterAppStateManager.attach(com.jme3.app.state.AppState)
was called.AppStateManager
will call this only from the update loop inside the rendering thread. This means is it safe to modify the scene graph from this method.- Specified by:
initialize
in interfaceAppState
- Overrides:
initialize
in classAbstractAppState
- Parameters:
stateManager
- The state managerapp
- The application
-
stateAttached
Description copied from interface:AppState
Called byAppStateManager.attach(com.jme3.app.state.AppState)
when transitioning thisAppState
from detached to initializing.There is no assumption about the thread from which this function is called, therefore it is unsafe to modify the scene graph from this method. Please use
AppState.initialize(com.jme3.app.state.AppStateManager, com.jme3.app.Application)
instead.- Specified by:
stateAttached
in interfaceAppState
- Overrides:
stateAttached
in classAbstractAppState
- Parameters:
stateManager
- State manager to which the state was attached to.
-
setEnabled
public void setEnabled(boolean enabled) Description copied from interface:AppState
Enable or disable the functionality of theAppState
. The effect of this call depends on implementation. AnAppState
starts as being enabled by default. A disabledAppState
s does not get calls toAppState.update(float)
,AppState.render(RenderManager)
, orAppState.postRender()
from itsAppStateManager
.- Specified by:
setEnabled
in interfaceAppState
- Overrides:
setEnabled
in classAbstractAppState
- Parameters:
enabled
- activate the AppState or not.
-
update
public void update(float tpf) Description copied from interface:AppState
Called to update theAppState
. This method will be called every render pass if theAppState
is both attached and enabled.- Specified by:
update
in interfaceAppState
- Overrides:
update
in classAbstractAppState
- Parameters:
tpf
- Time since the last call to update(), in seconds.
-
cleanup
public void cleanup()Description copied from interface:AppState
Called byAppStateManager
when transitioning thisAppState
from terminating to detached. This method is called the following render pass after theAppState
has been detached and is always called once and only once for each timeinitialize()
is called. Either when theAppState
is detached or when the application terminates (if it terminates normally).- Specified by:
cleanup
in interfaceAppState
- Overrides:
cleanup
in classAbstractAppState
-
getComponent
Get the AWT component that is used as rendering output.- Returns:
- the AWT component that is used as rendering output.
- See Also:
-
setComponent
Set the AWT component that is used as rendering output.- Parameters:
component
- the AWT component that is used as rendering output.- See Also:
-
getTransferMode
Get thetransfer mode
that is used by the underlying frame processor.- Returns:
- the
transfer mode
that is used by the underlying frame processor. - See Also:
-
setTransferMode
Set thetransfer mode
that is used by the underlying frame processor.- Parameters:
mode
- thetransfer mode
that is used by the underlying frame processor.- See Also:
-