Advertisement
Guest User

Untitled

a guest
Mar 15th, 2012
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.36 KB | None | 0 0
  1. package game.gui.screens;
  2.  
  3. import de.lessvoid.nifty.Nifty;
  4. import de.lessvoid.nifty.builder.LayerBuilder;
  5. import de.lessvoid.nifty.builder.ScreenBuilder;
  6. import de.lessvoid.nifty.controls.scrollpanel.builder.ScrollPanelBuilder;
  7.  
  8. public class ShowQuestObjectiveStateStartScreen {
  9.  
  10.     private static ShowQuestObjectiveStateStartScreen instance;
  11.     public static ShowQuestObjectiveStateStartScreen getInstance() {
  12.         if (instance == null) {
  13.             instance = new ShowQuestObjectiveStateStartScreen();
  14.         }
  15.         return instance;
  16.     }
  17.  
  18.     public void createScreen(Nifty nifty) {
  19.         nifty.loadControlFile("nifty-default-controls.xml");
  20.         nifty.loadStyleFile("nifty-default-styles.xml");
  21.  
  22.         new ScreenBuilder("ShowQuestObjective", null) {
  23.             {
  24.                 layer(new LayerBuilder("background") {
  25.                     {
  26.                         backgroundImage("resources/images/Book.png");
  27.                             // Using the builder pattern create a ScrollPanel with the id "scrollPanelId" that uses an image as the content to be scrolled around
  28.                         childLayoutAbsoluteInside();
  29.                         control(new ScrollPanelBuilder("scrollPanel") {{
  30.                           x("100px"); y("100px");                          
  31.                           width("200px"); height("200px");
  32.                           set( "vertical", "true" );
  33.                           set( "horizontal", "true" );
  34.                         }});
  35.                     }
  36.                 });
  37.             }
  38.         }.build(nifty);
  39.        
  40.         nifty.gotoScreen("ShowQuestObjective");
  41.         nifty.getCurrentScreen().startScreen();
  42.     }
  43.  
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement