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
ConstructorsConstructorDescriptionAWTComponentAppState(Component component) Create a new app state dedicated to the rendering of a JMonkey application within the given AWTcomponent. -
Method Summary
Modifier and TypeMethodDescriptionvoidcleanup()Called byAppStateManagerwhen transitioning thisAppStatefrom terminating to detached.Get the AWT component that is used as rendering output.Get thetransfer modethat is used by the underlying frame processor.voidinitialize(AppStateManager stateManager, Application app) Called byAppStateManagerwhen transitioning thisAppStatefrom initializing to running.
This will happen on the next iteration through the update loop afterAppStateManager.attach(com.jme3.app.state.AppState)was called.voidsetComponent(Component component) Set the AWT component that is used as rendering output.voidsetEnabled(boolean enabled) Enable or disable the functionality of theAppState.voidSet thetransfer modethat is used by the underlying frame processor.voidstateAttached(AppStateManager stateManager) Called byAppStateManager.attach(com.jme3.app.state.AppState)when transitioning thisAppStatefrom detached to initializing.voidupdate(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:AppStateCalled byAppStateManagerwhen transitioning thisAppStatefrom initializing to running.
This will happen on the next iteration through the update loop afterAppStateManager.attach(com.jme3.app.state.AppState)was called.AppStateManagerwill 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:
initializein interfaceAppState- Overrides:
initializein classAbstractAppState- Parameters:
stateManager- The state managerapp- The application
-
stateAttached
Description copied from interface:AppStateCalled byAppStateManager.attach(com.jme3.app.state.AppState)when transitioning thisAppStatefrom 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:
stateAttachedin interfaceAppState- Overrides:
stateAttachedin classAbstractAppState- Parameters:
stateManager- State manager to which the state was attached to.
-
setEnabled
public void setEnabled(boolean enabled) Description copied from interface:AppStateEnable or disable the functionality of theAppState. The effect of this call depends on implementation. AnAppStatestarts as being enabled by default. A disabledAppStates does not get calls toAppState.update(float),AppState.render(RenderManager), orAppState.postRender()from itsAppStateManager.- Specified by:
setEnabledin interfaceAppState- Overrides:
setEnabledin classAbstractAppState- Parameters:
enabled- activate the AppState or not.
-
update
public void update(float tpf) Description copied from interface:AppStateCalled to update theAppState. This method will be called every render pass if theAppStateis both attached and enabled.- Specified by:
updatein interfaceAppState- Overrides:
updatein classAbstractAppState- Parameters:
tpf- Time since the last call to update(), in seconds.
-
cleanup
public void cleanup()Description copied from interface:AppStateCalled byAppStateManagerwhen transitioning thisAppStatefrom terminating to detached. This method is called the following render pass after theAppStatehas been detached and is always called once and only once for each timeinitialize()is called. Either when theAppStateis detached or when the application terminates (if it terminates normally).- Specified by:
cleanupin interfaceAppState- Overrides:
cleanupin 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 modethat is used by the underlying frame processor.- Returns:
- the
transfer modethat is used by the underlying frame processor. - See Also:
-
setTransferMode
Set thetransfer modethat is used by the underlying frame processor.- Parameters:
mode- thetransfer modethat is used by the underlying frame processor.- See Also:
-