List of usage examples for com.badlogic.gdx.scenes.scene2d.ui ScrollPane setWidget
public void setWidget(Actor widget)
From source file:at.hid.tabletopsimulator.screens.About.java
License:Apache License
@Override public void show() { TableTopSimulator.debug(this.getClass().toString(), "creating About screen"); stage = new Stage(new ExtendViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight())); Gdx.input.setInputProcessor(stage);//ww w. j ava 2s. c o m // creating skin TableTopSimulator.debug(this.getClass().toString(), "creating skin"); skin = TableTopSimulator.assets.get("ui/gui.json", Skin.class); table = new Table(skin); // table.setFillParent(true); // table.setBounds(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight()); // creating heading TableTopSimulator.debug(this.getClass().toString(), "creating heading"); Label lblHeading = new Label(TableTopSimulator.getLangBundle().format("About.lblHeading.text"), skin); final Label lblContent = new Label("http://libgdx.badlogicgames.com/\r\n" + "\r\n" + "libGDX is licensed under the Apache 2 License,\r\n" + "meaning you can use it free of charge, without strings attached in commercial and non-commercial projects.\r\n" + "We love to get (non-mandatory) credit in case you release a game or app using libgdx!", skin, "content"); // creating list final List<String> listAbout = new List<String>(skin, "content"); ArrayList<String> newItems = new ArrayList<String>(); newItems.add("libgdx"); newItems.add("libgdx-utils"); newItems.add("flare gameart"); String[] data = new String[newItems.size()]; listAbout.setItems(newItems.toArray(data)); listAbout.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { if (listAbout.getSelected().equals("libgdx")) { lblContent.clear(); lblContent.setText("http://libgdx.badlogicgames.com/\r\n" + "\r\n" + "libGDX is licensed under the Apache 2 License,\r\n" + "meaning you can use it free of charge, without strings attached in commercial and non-commercial projects.\r\n" + "We love to get (non-mandatory) credit in case you release a game or app using libgdx!"); } else if (listAbout.getSelected().equals("libgdx-utils")) { lblContent.clear(); lblContent.setText("https://bitbucket.org/dermetfan/libgdx-utils/wiki/Home\r\n" + "\r\n" + "/* Copyright (c) 2014 PixelScientists\r\n" + "*\r\n" + "* The MIT License (MIT)\r\n" + "*\r\n" + "* Permission is hereby granted, free of charge, to any person obtaining a copy of\r\n" + "* this software and associated documentation files (the \"Software\"), to deal in\r\n" + "* the Software without restriction, including without limitation the rights to\r\n" + "* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\r\n" + "* the Software, and to permit persons to whom the Software is furnished to do so,\r\n" + "* subject to the following conditions:\r\n" + "*\r\n" + "* The above copyright notice and this permission notice shall be included in all\r\n" + "* copies or substantial portions of the Software.\r\n" + "*\r\n" + "* THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\n" + "* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\r\n" + "* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\r\n" + "* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\r\n" + "* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r\n" + "* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n" + "*/"); } else if (listAbout.getSelected().equals("flare gameart")) { lblContent.clear(); lblContent.setText("https://github.com/clintbellanger/flare-game\r\n" + "\r\n" + "Flare (the game) is Copyright 2010-2013 Clint Bellanger. Contributors retain copyrights to their original contributions.\r\n" + "\r\n" + "The Flare Engine is released under GPL version 3 or later.\r\n" + "\r\n" + "All of Flare's art and data files are released under CC-BY-SA 3.0. Later versions are permitted.\r\n" + "\r\n" + "The Liberation Sans fonts version 2 are released under the SIL Open Font License, Version 1.1.\r\n" + "\r\n" + "The GNU Unifont font is released under GPL v2, with the exception that embedding the font in a document does not in itself bind that document to the terms of the GPL."); } } }); // creating buttons TableTopSimulator.debug(this.getClass().toString(), "creating buttons"); TextButton btnBack = new TextButton(TableTopSimulator.getLangBundle().format("About.btnBack.text"), skin); btnBack.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { TableTopSimulator.debug(this.getClass().toString(), "switching to Options screen"); ((Game) Gdx.app.getApplicationListener()).setScreen(new Options()); dispose(); } }); btnBack.pad(10); ScrollPane spAboutList = new ScrollPane(null, skin); ScrollPane spAboutContent = new ScrollPane(null, skin); SplitPane splitAbout = new SplitPane(spAboutList, spAboutContent, false, skin); splitAbout.setSplitAmount(0.2f); spAboutList.setWidget(listAbout); spAboutContent.setWidget(lblContent); // building ui TableTopSimulator.debug(this.getClass().toString(), "building ui"); table.add(lblHeading).spaceBottom(100).row(); table.add(splitAbout).spaceBottom(15).width(1200).row(); table.add(btnBack).spaceBottom(15).row(); if (TableTopSimulator.DEBUG) { table.debug(); // draw debug lines splitAbout.debug(); // draw debug lines } stage.addActor(table); }
From source file:com.agateau.ui.UiBuilder.java
License:Apache License
protected ScrollPane createScrollPane(XmlReader.Element element) { String styleName = element.getAttribute("style", ""); ScrollPane pane; if (styleName.isEmpty()) { pane = new ScrollPane(null); } else {//from ww w. j av a 2 s. co m pane = new ScrollPane(null, mSkin, styleName); } Actor child = doBuild(element, null); if (child != null) { pane.setWidget(child); } return pane; }
From source file:com.digitale.screens.CharCreator.java
License:Open Source License
public CharCreator(final Integer muser) { Stardust3d.currencharacteruid = "" + Stardust3d.charList[0].getUid(); // populate avatardropdown for (int i = 0; i < Stardust3d.avatarList.size(); i++) { listEntries[i] = Stardust3d.avatarList.get(i).getDescription(); // do avatar dropdown population from db here }/* ww w.j ava2 s . c o m*/ selectedAvatar = ("avatar00.jpg"); OrthographicCamera camera; batch = new SpriteBatch(); skin = new Skin(Gdx.files.internal("data/uiskin.json"), Gdx.files.internal("data/uiskin.png")); xfadeTexture = new Texture(Gdx.files.internal("data/blackpixel.png"), Format.RGB565, true); xfadeTexture.setFilter(TextureFilter.MipMap, TextureFilter.Linear); background = new Texture(Gdx.files.internal("data/bgpland.jpg")); camera = new OrthographicCamera(); camera.setToOrtho(false, Gdx.app.getGraphics().getWidth(), Gdx.app.getGraphics().getHeight()); fadeIn(); stage = new Stage(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false); Gdx.input.setInputProcessor(stage); // Group.debug = true; final Button buttonSaveCharacter = new TextButton("Save Character", skin.getStyle(TextButtonStyle.class), "button-save-char"); final Button buttonCancel = new TextButton("Cancel", skin.getStyle(TextButtonStyle.class), "button-cancel"); final Button buttonRandName = new TextButton("Generate Random Name", skin.getStyle(TextButtonStyle.class), "button-random-name"); final SelectBox dropdown = new SelectBox(listEntries, skin.getStyle(SelectBoxStyle.class), "combo"); final SelectBox dropdownsex = new SelectBox(listsexEntries, skin.getStyle(SelectBoxStyle.class), "combosex"); final SelectBox dropdownrace = new SelectBox(listraceEntries, skin.getStyle(SelectBoxStyle.class), "comborace"); final TextField textfieldFirstName = new TextField("", "Firstname", skin.getStyle(TextFieldStyle.class), "textfieldfirstname"); final TextField textfieldSurName = new TextField("", "Surname", skin.getStyle(TextFieldStyle.class), "textfieldsurname"); final Label lableracepicker = new Label("Race", skin.getStyle(LabelStyle.class), "label-race-picker"); final Label lablesexpicker = new Label("Sex", skin.getStyle(LabelStyle.class), "label-sex-picker"); final Label lableportraitpicker = new Label("Portrait", skin.getStyle(LabelStyle.class), "label-portrait-picker"); final Label lablefirstname = new Label("First name", skin.getStyle(LabelStyle.class), "label-firstname"); final Label lablesurname = new Label("Surname", skin.getStyle(LabelStyle.class), "label-surname"); imageActor = new Image(image0); final FlickScrollPane scrollPane = new FlickScrollPane(imageActor, "flickscroll"); final List list = new List(listEntries, skin.getStyle(ListStyle.class), "list"); final ScrollPane scrollPane2 = new ScrollPane(list, skin.getStyle(ScrollPaneStyle.class), "scroll"); scrollPane2.setWidget(list); final SplitPane splitPane = new SplitPane(scrollPane, scrollPane, false, skin.getStyle("default-horizontal", SplitPaneStyle.class), "split"); final Label lablerace = new Label(racetext, skin.getStyle(LabelStyle.class), "label-race"); lablerace.setWrap(true); final ScrollPane scrollPanerace = new ScrollPane(lablerace, skin.getStyle(ScrollPaneStyle.class), "scroll"); // set defaults selectedAvatar = (Stardust3d.avatarList.get(0).getImagename()); racetext = "Humans small size compared to other races, nimble hands and excellent sight allows them to handle thier ships with more finesse than other races."; racetext = racetext + "\n\n Racial Bonus:- +1 to dexterity."; racetext = racetext + "\n Skilled with Human ships and weaponry."; PrimaryStat = "Stamina " + 1 + "\nIntelligence " + 1 + "\nSocial " + 1 + "\nDexterity " + 2 + "\nLeadership " + 1 + "\nRecuperation " + 1 + ""; final Label PrimaryStatLabel = new Label(PrimaryStat + Stardust3d.myCharacter.getIntelligence(), skin.getStyle(LabelStyle.class), "primary-stat"); Window window = new Window("Create Character", skin.getStyle(WindowStyle.class), "window"); if (Stardust3d.DEBUG) window.debug(); window.x = window.y = 0; window.setFillParent(true); window.setMovable(false); window.defaults().pad(5); window.defaults().spaceBottom(5).align("top"); window.row().fill().expandX(); window.add(buttonCancel).colspan(2); window.add().colspan(2).maxWidth(200); window.add(buttonSaveCharacter).colspan(2); window.row(); window.add(lableracepicker).align("middleleft"); window.add(dropdownrace).colspan(1).maxHeight(32); window.add(lableportraitpicker).align("middleleft"); window.add(dropdown).colspan(1).maxHeight(32); window.add(lablesexpicker).align("middleleft"); window.add(dropdownsex).colspan(1).maxHeight(32); window.row(); window.add(scrollPanerace).fill().expand().colspan(2).align("topleft"); window.add(PrimaryStatLabel).colspan(2); window.add().minHeight(256).colspan(2); window.row(); window.add(lablefirstname).align("middleleft"); window.add(textfieldFirstName); window.add(lablesurname).align("middleleft"); window.add(textfieldSurName); window.add(buttonRandName).colspan(2); window.pack(); stage.addActor(window); dropdown.setSelectionListener(new SelectionListener() { @Override public void selected(Actor actor, int index, String value) { SoundManager.playuiclick(); selectedAvatar = (Stardust3d.avatarList.get(index).getImagename()); } }); dropdownsex.setSelectionListener(new SelectionListener() { @Override public void selected(Actor actor, int index, String value) { SoundManager.playuiclick(); selectedSex = value; } }); dropdownrace.setSelectionListener(new SelectionListener() { @Override public void selected(Actor actor, int index, String value) { SoundManager.playuiclick(); switch (index) { case 0: racetext = "Humans small size compared to other races, nimble hands and excellent sight allows them to handle thier ships with more finesse than other races."; racetext = racetext + "\n\n Racial Bonus:- +1 to dexterity."; racetext = racetext + "\n Skilled with Human ships and weaponry."; selectedRace = "Human"; PrimaryStat = "Stamina " + 1 + "\nIntelligence " + 1 + "\nSocial " + 1 + "\nDexterity " + 2 + "\nLeadership " + 1 + "\nRecuperation " + 1; break; case 1: racetext = "Jelkek are a war-like race, for generations they have subjugated the Orinians to further their technological advancement. Fearless and bloodthirsty tendencies make their combat pilots unequalled."; racetext = racetext + "\n\n Racial Bonus:- +1 to recuperation."; racetext = racetext + "\n Skilled with Jelkek ships and weaponry."; selectedRace = "Jelkek"; PrimaryStat = "Stamina " + 1 + "\nIntelligence " + 1 + "\nSocial " + 1 + "\nDexterity " + 1 + "\nLeadership " + 1 + "\nRecuperation " + 2; break; case 2: racetext = "Orinians are masters of biotechnology, their skills make them the foremost manufacturers in the universe."; racetext = racetext + "\n\n Racial Bonus:- +1 to intelligence."; racetext = racetext + "\n Skilled with Orinian ships and weaponry."; selectedRace = "Orinian"; PrimaryStat = "Stamina " + 1 + "\nIntelligence " + 2 + "\nSocial " + 1 + "\nDexterity " + 1 + "\nLeadership " + 1 + "\nRecuperation " + 1; break; case 3: racetext = "Gulhurg colonies are unarguably the most complex systems known to science. Their hive-like social structure gives them an unrivalled empathy with others, making them excellent traders."; racetext = racetext + "\n\n Racial Bonus:- +1 to social."; racetext = racetext + "\n Skilled with Gulhurg ships and weaponry."; selectedRace = "Gulhurg"; PrimaryStat = "Stamina " + 1 + "\nIntelligence " + 1 + "\nSocial " + 2 + "\nDexterity " + 1 + "\nLeadership " + 1 + "\nRecuperation " + 1; break; } } }); buttonSaveCharacter.setClickListener(new ClickListener() { public void click(Actor actor, float x, float y) { if (Stardust3d.DEBUG) System.out.println("Charmaker Complete"); if (textfieldFirstName.getText().length() < 1) { SoundManager.playError(); stage.addActor(Actors.bottomToast("Character first name cannot be blank.", 4, skin)); } else { SoundManager.playuiclick(); // populate game from db, based on this char // Stardust3d.gameMode = 4; String result = Stardust3d.MyDataOp.makeAvatar(selectedAvatar, selectedRace, selectedSex, textfieldFirstName.getText(), textfieldSurName.getText(), muser); if (Stardust3d.DEBUG) System.out.println(LOG_TAG + "Everworld: char creation result: " + result); if (result.trim().equals("ok")) { Stardust3d.gameMode = 3; // repopulate players characters Stardust3d.populateCharacterlist(Stardust3d.muser); doneflag = true; } else { SoundManager.playError(); stage.addActor(Actors.bottomToast("This character name is taken, please choose another.", 4, skin)); } } } }); buttonCancel.setClickListener(new ClickListener() { public void click(Actor actor, float x, float y) { SoundManager.playuiclick(); stage.addActor(Actors.bottomToast("Cancelling character creation", 4, skin)); doneflag = true; Stardust3d.gameMode = 3; } }); buttonRandName.setClickListener(new ClickListener() { public void click(Actor actor, float x, float y) { SoundManager.playuiclick(); // generate human female name if (selectedSex.equals("Female") && selectedRace.equals("Human")) { Stardust3d.MyDataOp.getRandomHumanFemaleName(); textfieldFirstName.setText(Stardust3d.generatedFirstName); textfieldSurName.setText(Stardust3d.generatedSurName); // generate human male name } else if (selectedSex.equals("Male") && selectedRace.equals("Human")) { Stardust3d.MyDataOp.getRandomHumanMaleName(); textfieldFirstName.setText(Stardust3d.generatedFirstName); textfieldSurName.setText(Stardust3d.generatedSurName); // generate Jelkek female name } else if (selectedSex.equals("Female") && selectedRace.equals("Jelkek")) { Stardust3d.MyDataOp.getRandomHumanMaleName(); textfieldFirstName.setText(Stardust3d.generatedFirstName); textfieldSurName.setText(Stardust3d.generatedSurName); // generate Jelkek male name } else if (selectedSex.equals("Male") && selectedRace.equals("Jelkek")) { Stardust3d.MyDataOp.getRandomHumanMaleName(); textfieldFirstName.setText(Stardust3d.generatedFirstName); textfieldSurName.setText(Stardust3d.generatedSurName); // generate Orinian female name } else if (selectedSex.equals("Female") && selectedRace.equals("Orinian")) { Stardust3d.MyDataOp.getRandomHumanMaleName(); textfieldFirstName.setText(Stardust3d.generatedFirstName); textfieldSurName.setText(Stardust3d.generatedSurName); // generate Orinain male name } else if (selectedSex.equals("Male") && selectedRace.equals("Orinain")) { Stardust3d.MyDataOp.getRandomHumanMaleName(); textfieldFirstName.setText(Stardust3d.generatedFirstName); textfieldSurName.setText(Stardust3d.generatedSurName); // generate Gulhurg female name } else if (selectedSex.equals("Female") && selectedRace.equals("Gulhurg")) { Stardust3d.MyDataOp.getRandomHumanMaleName(); textfieldFirstName.setText(Stardust3d.generatedFirstName); textfieldSurName.setText(Stardust3d.generatedSurName); // generate Gulhurg male name } else if (selectedSex.equals("Male") && selectedRace.equals("Gulhurg")) { Stardust3d.MyDataOp.getRandomHumanMaleName(); textfieldFirstName.setText(Stardust3d.generatedFirstName); textfieldSurName.setText(Stardust3d.generatedSurName); } } }); DialogListener dialogListener = (new DialogListener() { @Override public void optionSelected(int option) { if (Stardust3d.DEBUG) System.out.println("option " + option); if (option == 1) { if (Stardust3d.DEBUG) System.out.println("no"); stage.removeActor(dialog); } if (option == 0) { if (Stardust3d.DEBUG) System.out.println("yes"); stage.removeActor(dialog); } } }); }
From source file:com.digitale.screens.MapScreen.java
License:Open Source License
public MapScreen(Stage stage) { for (int i = 0; i < Stardust3d.charList.length; i++) { listEntries[i] = (Stardust3d.charList[i].getFirstname() + " \n" + Stardust3d.charList[i].getSurname() + " \n " + "10000c "); listEntries[i] = listEntries[i] + ("System " + Stardust3d.charList[i].getSystem() + " \nSta " + Stardust3d.charList[i].getStamina() + " Int " + Stardust3d.charList[i].getIntelligence() + " Soc " + Stardust3d.charList[i].getSocial() + " Dex " + Stardust3d.charList[i].getDexterity() + " Led " + Stardust3d.charList[i].getLeadership() + " Rec " + Stardust3d.charList[i].getRecuperation() + " \nFlying: " + Util.asCapFirstChar(Stardust3d.charList[i].getShipname())); }//from www . ja v a 2s.co m skin = new Skin(Gdx.files.internal("data/uiskin.json"), Gdx.files.internal("data/uiskin.png")); texture1 = new Texture(Gdx.files.internal("data/stickleback.png")); texture2 = new Texture(Gdx.files.internal("data/salx.png")); TextureRegion image = new TextureRegion(texture1); TextureRegion image2 = new TextureRegion(texture2); Gdx.input.setInputProcessor(stage); // Group.debug = true; final Label nameLabel = new Label( Stardust3d.myCharacter.getFirstname() + Stardust3d.myCharacter.getSurname(), skin.getStyle(LabelStyle.class), "namelable"); final Label IntelligenceLabel = new Label("PLACEHOLDER " + Stardust3d.myCharacter.getIntelligence(), skin.getStyle(LabelStyle.class), "intelligencelable"); final Button buttonClose = new TextButton("Close", skin.getStyle(TextButtonStyle.class), "button-close"); final SelectBox dropdown = new SelectBox(listEntries, skin.getStyle(SelectBoxStyle.class), "combo"); final Image imageActor = new Image(image2); final FlickScrollPane scrollPane = new FlickScrollPane(imageActor, "flickscroll"); final List list = new List(listEntries, skin.getStyle(ListStyle.class), "list"); final ScrollPane scrollPane2 = new ScrollPane(list, skin.getStyle(ScrollPaneStyle.class), "scroll"); scrollPane2.setWidget(list); final SplitPane splitPane = new SplitPane(scrollPane, scrollPane2, false, skin.getStyle("default-horizontal", SplitPaneStyle.class), "split"); final Label fpsLabel = new Label("fps:", skin.getStyle(LabelStyle.class), "label"); selectedCharacter = ("Character: " + Stardust3d.charList[0].getFirstname() + " \n" + Stardust3d.charList[0].getSurname()); Window window = new Window("Map Screen", skin.getStyle(WindowStyle.class), "mapWindow"); if (Stardust3d.DEBUG) window.debug(); window.x = window.y = 0; window.setFillParent(true); window.setMovable(false); window.defaults().pad(5); window.defaults().spaceBottom(5); window.row().fill().expandX(); window.add(); window.add(buttonClose).colspan(1); window.row(); window.add(nameLabel); window.add(); window.add(); window.add(); window.row(); window.add(IntelligenceLabel); window.row(); // window.add(setWidget(list)); window.row(); window.add(splitPane).colspan(4); window.row(); window.row(); window.pack(); // stage.addActor(new Button("Behind Window", skin)); stage.addActor(window); dropdown.setSelectionListener(new SelectionListener() { @Override public void selected(Actor actor, int index, String value) { SoundManager.playuiclick(); selectedCharacter = ("Character: " + Stardust3d.charList[index].getFirstname() + " \n" + Stardust3d.charList[index].getSurname()); Stardust3d.currencharacteruid = "" + Stardust3d.charList[index].getUid(); } }); buttonClose.setClickListener(new ClickListener() { public void click(Actor actor, float x, float y) { System.out.println("mapscreen Close"); SoundManager.playuiclick(); Stardust3d.stationScreen = 112; doneflag = true; } }); }
From source file:com.digitale.screens.Market.java
License:Open Source License
public Market(Stage stage) { for (int i = 0; i < Stardust3d.charList.length; i++) { listEntries[i] = (Stardust3d.charList[i].getFirstname() + " \n" + Stardust3d.charList[i].getSurname() + " \n " + "10000c "); listEntries[i] = listEntries[i] + ("System " + Stardust3d.charList[i].getSystem() + " \nSta " + Stardust3d.charList[i].getStamina() + " Int " + Stardust3d.charList[i].getIntelligence() + " Soc " + Stardust3d.charList[i].getSocial() + " Dex " + Stardust3d.charList[i].getDexterity() + " Led " + Stardust3d.charList[i].getLeadership() + " Rec " + Stardust3d.charList[i].getRecuperation() + " \nFlying: " + Util.asCapFirstChar(Stardust3d.charList[i].getShipname())); }//from w w w . j a v a2s . com skin = new Skin(Gdx.files.internal("data/uiskin.json"), Gdx.files.internal("data/uiskin.png")); texture1 = new Texture(Gdx.files.internal("data/beer.png")); texture2 = new Texture(Gdx.files.internal("data/blueprint.png")); TextureRegion image = new TextureRegion(texture1); TextureRegion image2 = new TextureRegion(texture2); Gdx.input.setInputProcessor(stage); // Group.debug = true; final Label nameLabel = new Label( Stardust3d.myCharacter.getFirstname() + " \n" + Stardust3d.myCharacter.getSurname(), skin.getStyle(LabelStyle.class), "namelable"); final Label IntelligenceLabel = new Label("PLACEHOLDER " + Stardust3d.myCharacter.getIntelligence(), skin.getStyle(LabelStyle.class), "intelligencelable"); final Button buttonClose = new TextButton("Close", skin.getStyle(TextButtonStyle.class), "button-close"); final SelectBox dropdown = new SelectBox(listEntries, skin.getStyle(SelectBoxStyle.class), "combo"); final Image imageActor = new Image(image2); final FlickScrollPane scrollPane = new FlickScrollPane(imageActor, "flickscroll"); final List list = new List(listEntries, skin.getStyle(ListStyle.class), "list"); final ScrollPane scrollPane2 = new ScrollPane(list, skin.getStyle(ScrollPaneStyle.class), "scroll"); scrollPane2.setWidget(list); final SplitPane splitPane = new SplitPane(scrollPane, scrollPane2, false, skin.getStyle("default-horizontal", SplitPaneStyle.class), "split"); final Label fpsLabel = new Label("fps:", skin.getStyle(LabelStyle.class), "label"); selectedCharacter = ("Character: " + Stardust3d.charList[0].getFirstname() + " \n" + Stardust3d.charList[0].getSurname()); // window.debug(); Window window = new Window("Market Screen", skin.getStyle(WindowStyle.class), "marketWindow"); if (Stardust3d.DEBUG) window.debug(); window.x = window.y = 0; window.setFillParent(true); window.setMovable(false); window.defaults().pad(5); window.defaults().spaceBottom(5); window.row().fill().expandX(); window.add(); window.add(buttonClose).colspan(1); window.row(); window.add(nameLabel); window.add(); window.add(); window.add(); window.row(); window.add(IntelligenceLabel); window.row(); // window.add(setWidget(list)); window.row(); window.add(splitPane).colspan(4); window.row(); window.row(); window.add(fpsLabel).colspan(4); window.pack(); // stage.addActor(new Button("Behind Window", skin)); stage.addActor(window); dropdown.setSelectionListener(new SelectionListener() { @Override public void selected(Actor actor, int index, String value) { SoundManager.playuiclick(); selectedCharacter = ("Character: " + Stardust3d.charList[index].getFirstname() + " \n" + Stardust3d.charList[index].getSurname()); Stardust3d.currencharacteruid = "" + Stardust3d.charList[index].getUid(); } }); buttonClose.setClickListener(new ClickListener() { public void click(Actor actor, float x, float y) { System.out.println("Market Close"); SoundManager.playuiclick(); Stardust3d.stationScreen = 109; } }); }
From source file:com.digitale.screens.Solar.java
License:Open Source License
public Solar() { for (int i = 0; i < Stardust3d.charList.length; i++) { listEntries[i] = (Stardust3d.charList[i].getFirstname() + " \n" + Stardust3d.charList[i].getSurname() + " \n " + "10000c "); listEntries[i] = listEntries[i] + ("System " + Stardust3d.charList[i].getSystem() + " \nSta " + Stardust3d.charList[i].getStamina() + " Int " + Stardust3d.charList[i].getIntelligence() + " Soc " + Stardust3d.charList[i].getSocial() + " Dex " + Stardust3d.charList[i].getDexterity() + " Led " + Stardust3d.charList[i].getLeadership() + " Rec " + Stardust3d.charList[i].getRecuperation() + " \nFlying: " + Util.asCapFirstChar(Stardust3d.charList[i].getShipname())); }// w w w.j av a 2 s.c om batch = new SpriteBatch(); skin = new Skin(Gdx.files.internal("data/uiskin.json"), Gdx.files.internal("data/uiskin.png")); texture1 = new Texture(Gdx.files.internal("data/badlogicsmall.jpg")); texture2 = new Texture(Gdx.files.internal("data/badlogic.jpg")); TextureRegion image = new TextureRegion(texture1); TextureRegion image2 = new TextureRegion(texture2); stage = new Stage(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), false); Gdx.input.setInputProcessor(stage); // Group.debug = true; final Label nameLabel = new Label( Stardust3d.myCharacter.getFirstname() + " \n" + Stardust3d.myCharacter.getSurname(), skin.getStyle(LabelStyle.class), "namelable"); final Label IntelligenceLabel = new Label("Inteligence " + Stardust3d.myCharacter.getIntelligence(), skin.getStyle(LabelStyle.class), "intelligencelable"); final Button buttonEnterGame = new TextButton("Enter Game", skin.getStyle(TextButtonStyle.class), "button-enter-game"); final Button buttonNewCharacter = new TextButton("New Character", skin.getStyle(TextButtonStyle.class), "button-enter-game"); final Button buttonDeleteCharacter = new TextButton("Delete Character", skin.getStyle(TextButtonStyle.class), "button-enter-game"); final TextField textfield = new TextField("", "Click here!", skin.getStyle(TextFieldStyle.class), "textfield"); final SelectBox dropdown = new SelectBox(listEntries, skin.getStyle(SelectBoxStyle.class), "combo"); final Image imageActor = new Image(image2); final FlickScrollPane scrollPane = new FlickScrollPane(imageActor, "flickscroll"); final List list = new List(listEntries, skin.getStyle(ListStyle.class), "list"); final ScrollPane scrollPane2 = new ScrollPane(list, skin.getStyle(ScrollPaneStyle.class), "scroll"); scrollPane2.setWidget(list); final SplitPane splitPane = new SplitPane(scrollPane, scrollPane2, false, skin.getStyle("default-horizontal", SplitPaneStyle.class), "split"); final Label fpsLabel = new Label("fps:", skin.getStyle(LabelStyle.class), "label"); selectedCharacter = ("Character: " + Stardust3d.charList[0].getFirstname() + " \n" + Stardust3d.charList[0].getSurname()); // window.debug(); Window window = new Window("Solar Info Screen", skin.getStyle(WindowStyle.class), "window"); window.x = window.y = 0; window.setFillParent(true); window.setMovable(false); window.defaults().pad(5); window.defaults().spaceBottom(5); window.row().fill().expandX(); window.add(buttonNewCharacter); window.add(buttonDeleteCharacter); window.add(buttonEnterGame); window.row(); window.add(nameLabel); window.row(); window.add(IntelligenceLabel); window.add(IntelligenceLabel); window.add(IntelligenceLabel); window.add(IntelligenceLabel); window.add(IntelligenceLabel); window.row(); // window.add(setWidget(list)); window.row(); window.add(splitPane).colspan(4); window.row(); window.row(); window.add(fpsLabel).colspan(4); window.pack(); // stage.addActor(new Button("Behind Window", skin)); stage.addActor(window); textfield.setTextFieldListener(new TextFieldListener() { public void keyTyped(TextField textField, char key) { if (key == '\n') textField.getOnscreenKeyboard().show(false); } }); dropdown.setSelectionListener(new SelectionListener() { @Override public void selected(Actor actor, int index, String value) { SoundManager.playuiclick(); selectedCharacter = ("Character: " + Stardust3d.charList[index].getFirstname() + " \n" + Stardust3d.charList[index].getSurname()); Stardust3d.currencharacteruid = "" + Stardust3d.charList[index].getUid(); } }); buttonEnterGame.setClickListener(new ClickListener() { public void click(Actor actor, float x, float y) { System.out.println("Charpicker Close"); SoundManager.playuiclick(); // populate game from db, based on this char Stardust3d.gameMode = 4; // Stardust3d.character="35"; /* Stardust3d.MyDataOp.get3dChar(Integer .valueOf(Stardust3d.currencharacteruid)); Stardust3d.MyDataOp.getInventory(Integer .valueOf(Stardust3d.currencharacteruid)); Stardust3d.MyDataOp.getSolarSystem( Stardust3d.myCharacter.getX(), Stardust3d.myCharacter.getY(), Stardust3d.myCharacter.getZ());*/ doneflag = true; } }); }
From source file:net.dermetfan.gdx.scenes.scene2d.ui.TreeFileChooser.java
License:Apache License
/** @param treePane the {@link #treePane} to set */ public void setTreePane(ScrollPane treePane) { treePane.setWidget(tree); getCell(this.treePane).setActor(this.treePane = treePane); }
From source file:net.mwplay.cocostudio.ui.parser.group.CCScrollView.java
License:Apache License
@Override public Actor parse(CocoStudioUIEditor editor, ObjectData widget) { ScrollPaneStyle style = new ScrollPaneStyle(); if (widget.getFileData() != null) { style.background = editor.findDrawable(widget, widget.getFileData()); }// w w w . ja v a 2 s .co m ScrollPane scrollPane = new ScrollPane(null, style); if ("Vertical_Horizontal".equals(widget.getScrollDirectionType())) { scrollPane.setForceScroll(true, true); } else if ("Horizontal".equals(widget.getScrollDirectionType())) { scrollPane.setForceScroll(true, false); } else if ("Vertical".equals(widget.getScrollDirectionType())) { scrollPane.setForceScroll(false, true); } scrollPane.setClamp(widget.isClipAble()); scrollPane.setFlickScroll(widget.isIsBounceEnabled()); Table table = new Table(); table.setSize(widget.getInnerNodeSize().getWidth(), widget.getInnerNodeSize().getHeight()); if (widget.getComboBoxIndex() == 0) {// } else if (widget.getComboBoxIndex() == 1) {// ? Pixmap pixmap = new Pixmap((int) table.getWidth(), (int) table.getHeight(), Format.RGBA8888); Color color = editor.getColor(widget.getSingleColor(), widget.getBackColorAlpha()); pixmap.setColor(color); pixmap.fill(); Drawable drawable = new TextureRegionDrawable(new TextureRegion(new Texture(pixmap))); table.setBackground(drawable); pixmap.dispose(); } scrollPane.setWidget(table); return scrollPane; }
From source file:net.mwplay.cocostudio.ui.parser.group.CCScrollView.java
License:Apache License
@Override public Group groupChildrenParse(CocoStudioUIEditor editor, ObjectData widget, Group parent, Actor actor) { ScrollPane scrollPane = (ScrollPane) actor; Table table = new Table(); for (ObjectData childrenWidget : widget.getChildren()) { Actor childrenActor = editor.parseWidget(table, childrenWidget); if (childrenActor == null) { continue; }/* w w w . java 2 s .c o m*/ table.setSize(Math.max(table.getWidth(), childrenActor.getRight()), Math.max(table.getHeight(), childrenActor.getTop())); table.addActor(childrenActor); } sort(widget, table); // scrollPane.setWidget(table); return scrollPane; }