anchor.diff:  .  <<jme3/advanced/nifty_gui_overlay#,Nifty GUI Overlay>> or <<jme3/advanced/nifty_gui_projection#,Nifty GUI Projection>>
   .  *Nifty +++<abbr title="Graphical User Interface">GUI</abbr>+++ Java Interaction*
   
  -In the previous parts of the tutorial, you created a two-screen user interface. But it is still static, and when you click the buttons, nothing happens yet. The purpose of the +++<abbr title="Graphical User Interface">GUI</abbr>+++ is to communicate with your Java classes: Your game needs to know what the users clicked, which settings they chose, which values they entered into a field, etc. Similarly, the user needs to know what the currently game state is (score, health, etc). 
  +In the previous parts of the tutorial, you created a two-screen user interface. But it is still static, and when you click the buttons, nothing happens yet. The purpose of the +++<abbr title="Graphical User Interface">GUI</abbr>+++ is to communicate with your Java classes: Your game needs to know what the users clicked, which settings they chose, which values they entered into a field, etc. Similarly, the user needs to know what the currently game state is (score, health, etc).
   
   
   == Connect GUI to Java Controller
   
   To let a Nifty screen communicate with the Java application, you register a `ScreenController` to every NiftyGUI screen. You create a ScreenController by creating a Java class that implements the `de.lessvoid.nifty.screen.ScreenController` interface and its abstract methods.
   
  -Create an AppState *MyStartScreen*.java file in your package. ( Rightclick on your package → New → Other… → JME3 Classes → New AppState)
  -
  -*Pro Tip:* Since you are writing a jME3 application, you can additionally make the ScreenController class extend the <<jme3/advanced/application_states#,AbstractAppState>> class! This gives the ScreenController access to the application object and to the update loop!
  -
  -Now add *implements ScreenController* to _public class MyStartScreen extends AbstractAppState{_ and add *import de.lessvoid.nifty.screen.ScreenController;*
  +Create an AppState *MyStartScreen*.java file in your package. ( btn:[RMB] click on your package and select `menu:New[Other>JME3 Classes>New BaseAppState]`)
  +
  +*Pro Tip:* Since you are writing a jME3 application, you can additionally make the ScreenController class extend the <<jme3/advanced/application_states#,BaseAppState>> class! This gives the ScreenController access to the application object and to the update loop!
  +
  +Now add *implements ScreenController* to _public class MyStartScreen extends BaseAppState{_ and add *import de.lessvoid.nifty.screen.ScreenController;*
   
   Continue with adding:
   
  
positive.code: 
  [source,java]
  ----
  
    nifty.addScreen("start", new ScreenBuilder("start") {{
        controller(new mygame.MyStartScreen())}});
  
  ----
  
  Now the Java class `MyStartScreen` and this +++<abbr title="Graphical User Interface">GUI</abbr>+++ screen (`start`) are connected. For this example you can also connect the `hud` screen to MyStartScreen.
  
  
  == Make GUI and Java Interact
  
  
negative.code: 
  This is how you respond to an +++<abbr title="Graphical User Interface">GUI</abbr>+++ interaction such as clicks in XML GUIs:
  
  .  Add `visibleToMouse="true"` to the parent element!
  .  Embed the `<interact />` element into the parent element.
  .  Specify the Java methods that you want to call when the users performs certain actions, such as clicking. +
  Example: `<interact onClick="startGame(hud)" />`
  
  Or this is how you respond to an +++<abbr title="Graphical User Interface">GUI</abbr>+++ interaction such as clicks in Java GUIs:
  
  .  Add `visibleToMouse(true);` to the parent element!
  .  Embed one of the `interact…()` elements into the parent element.
  .  Specify the Java method that you want to call after the interaction. +
  Example: `interactOnClick("startGame(hud)");`
  
  In the following example, we call the `startGame()` method when the player clicks the Start button, and `quitGame()` when the player clicks the Quit button.
  
  [source,xml]
  ----
  
  <panel id="panel_bottom_left" height="50%" width="50%" valign="center" childLayout="center">
    <control name="button" label="Start" id="StartButton" align="center" valign="center"
      visibleToMouse="true" >
      <interact onClick="startGame(hud)"/>
    </control>
  </panel>
  
  <panel id="panel_bottom_right" height="50%" width="50%" valign="center" childLayout="center">
    <control name="button" label="Quit" id="QuitButton" align="center" valign="center"
      visibleToMouse="true" >
      <interact onClick="quitGame()"/>
    </control>
  </panel>
  
  ----
  
  