List of usage examples for com.badlogic.gdx.scenes.scene2d.ui ScrollPane setFlickScroll
public void setFlickScroll(boolean flickScroll)
From source file:com.ray3k.skincomposer.RootTable.java
License:Open Source License
private void addPreview(Table top, InputListener scrollPaneListener) { Label label = new Label("Preview", getSkin(), "title"); top.add(label);//from ww w.ja v a 2 s.c o m top.row(); previewTable = new Table(getSkin()); previewTable.setBackground("white"); ScrollPane scrollPane = new ScrollPane(previewTable, getSkin()); scrollPane.setFadeScrollBars(false); scrollPane.setFlickScroll(false); scrollPane.addListener(scrollPaneListener); top.add(scrollPane).grow().padTop(10.0f).padBottom(10.0f); refreshPreview(); }
From source file:com.ray3k.skincomposer.RootTable.java
License:Open Source License
private void addPreviewProperties(Table bottom, InputListener scrollPaneListener) { Label label = new Label("Preview Properties", getSkin(), "title"); bottom.add(label);//from w w w. jav a 2s . c o m bottom.row(); previewPropertiesTable = new Table(); previewPropertiesTable.defaults().pad(5.0f); ScrollPane scrollPane = new ScrollPane(previewPropertiesTable, getSkin()); scrollPane.setFadeScrollBars(false); scrollPane.setFlickScroll(false); scrollPane.addListener(scrollPaneListener); bottom.add(scrollPane).grow().padTop(10.0f).padBottom(10.0f); refreshPreviewProperties(); }
From source file:com.tumblr.oddlydrawn.nahlc.screens.LicenseScreen.java
License:Apache License
public LicenseScreen(Game g) { game = g;/* ww w . j a v a 2 s . c om*/ stage = new Stage(new FitViewport(WIDTH, HEIGHT)); skin = new Skin(); assets = new Assets(); assets.initMainMenu(); Gdx.input.setInputProcessor(stage); FileHandle handle; handle = Gdx.files.internal(LICENSE_PATH); licenseString = handle.readString(); Table table = new Table(); table.setFillParent(true); stage.addActor(table); skin.add("default", new BitmapFont(Gdx.files.internal(FONT_PATH))); LabelStyle labelStyle = new LabelStyle(); labelStyle.font = skin.getFont("default"); skin.add("default", labelStyle); ScrollPaneStyle scrollPaneStyle = new ScrollPaneStyle(); skin.add("default", scrollPaneStyle); TextButtonStyle textButtonStyle = new TextButtonStyle(); textButtonStyle.font = skin.getFont("default"); textButtonStyle.up = new NinePatchDrawable(assets.getBoxPatch()); skin.add("default", textButtonStyle); Label license = new Label(licenseString, skin); ScrollPane scrollPane = new ScrollPane(license, skin); scrollPane.setFlickScroll(true); table.add(scrollPane); table.row(); TextButton backButton = new TextButton("Back", skin); table.add(backButton).padTop(TABLE_PAD); table.padTop(TABLE_PAD); table.padBottom(TABLE_PAD); table.row(); backButton.addListener(new ChangeListener() { public void changed(ChangeEvent event, Actor actor) { dispose(); game.setScreen(new MainMenuScreen(game)); } }); }
From source file:com.tumblr.oddlydrawn.stupidworm.screens.LicenseScreen.java
License:Apache License
public LicenseScreen(Game g) { game = g;//from w w w .ja v a2 s. c om stage = new Stage(); skin = new Skin(); batch = new SpriteBatch(); FileHandle handle; handle = Gdx.files.internal(LICENSE_LOC); licenseString = handle.readString(); atlas = new TextureAtlas(Gdx.files.internal(TEXTURE_ATLAS_LOC)); NinePatch patchBox; patchBox = new NinePatch(atlas.createPatch(PATCH_BOX_REGION_STRING)); Gdx.input.setInputProcessor(stage); stage.setViewport(new StretchViewport(WIDTH, HEIGHT)); Table table = new Table(); table.setFillParent(true); stage.addActor(table); Pixmap pixmap = new Pixmap(1, 1, Format.RGBA8888); pixmap.setColor(Color.LIGHT_GRAY); pixmap.fill(); // The following defines the defaults for Scene2D's skin skin.add("grey", new Texture(pixmap)); skin.add("default", new BitmapFont(Gdx.files.internal(FONT_LOC))); LabelStyle labelStyle = new LabelStyle(); labelStyle.font = skin.getFont("default"); skin.add("default", labelStyle); ScrollPaneStyle scrollPaneStyle = new ScrollPaneStyle(); skin.add("default", scrollPaneStyle); ButtonStyle buttonStyle = new ButtonStyle(); skin.add("default", buttonStyle); TextButtonStyle textButtonStyle = new TextButtonStyle(); textButtonStyle.font = skin.getFont("default"); textButtonStyle.up = new NinePatchDrawable(patchBox); skin.add("default", textButtonStyle); // Creates Actors (the entire LICENSE text file) for Scene2D Label license = new Label(licenseString, skin); ScrollPane scrollPane = new ScrollPane(license, skin); scrollPane.setFlickScroll(true); table.add(scrollPane); // Creates the padding between the text and the button. table.row(); // Label padding = new Label(LABEL_PADDING, skin); // table.add(padding); // Creates the 'Okay' button table.row(); TextButton okay = new TextButton("Okay", skin); table.add(okay); okay.addListener(new ChangeListener() { public void changed(ChangeEvent event, Actor actor) { dispose(); game.setScreen(new MainMenuScreen(game)); } }); // Adds padding on top and on the bottom of the table. table.padTop(TABLE_PADDING); table.padBottom(TABLE_PADDING); table.pack(); }
From source file:com.uwsoft.editor.gdx.ui.AssetList.java
License:Apache License
public AssetList(final UIStage s, float width, float height) { this.setWidth(width); this.setHeight(height); final Table container = new Table(); Table table = new Table(); container.setX(0);/*w ww . ja v a 2 s .c om*/ container.setY(0); container.setWidth(getWidth() - 1); container.setHeight(getHeight() - 20); final ScrollPane scroll = new ScrollPane(table, s.textureManager.editorSkin); container.add(scroll).colspan(4).width(getWidth()); container.row(); scroll.addListener(new InputListener() { public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { event.stop(); return true; } }); scroll.setHeight(getHeight() - 20); scroll.setFlickScroll(false); TextureAtlas atlas = s.textureManager.getProjectAssetsList(); HashMap<String, SpineAnimData> spineAnimations = s.textureManager.getProjectSpineAnimationsList(); HashMap<String, TextureAtlas> spriteAnimations = s.textureManager.getProjectSpriteAnimationsList(); HashMap<String, FileHandle> spriterAnimations = s.textureManager.getProjectSpriterAnimationsList(); if (atlas == null) return; int itemIter = 0; for (int i = 0; i < atlas.getRegions().size; i++) { TextureAtlas.AtlasRegion atlasRegion = atlas.getRegions().get(i); boolean is9patch = atlasRegion.splits != null; final ImageThumbnailBox thumb = is9patch ? new Image9patchThumbnailBox(s, atlasRegion) : new ImageThumbnailBox(s, atlasRegion); table.add(thumb).pad(3); if ((itemIter - 7) % 4 == 0) { table.row(); } itemIter++; } for (String animationName : spineAnimations.keySet()) { final SpineAnimationThumbnailBox thumb = new SpineAnimationThumbnailBox(s, spineAnimations.get(animationName)); table.add(thumb).size(50, 50).pad(3); if ((itemIter - 7) % 4 == 0) { table.row(); } itemIter++; } for (String animationName : spriteAnimations.keySet()) { final SpriteAnimationThumbnailBox thumb = new SpriteAnimationThumbnailBox(s, animationName); table.add(thumb).size(50, 50).pad(3); if ((itemIter - 7) % 4 == 0) { table.row(); } itemIter++; } for (String animationName : spriterAnimations.keySet()) { final SpriterAnimationThumbnailBox thumb = new SpriterAnimationThumbnailBox(s, animationName); table.add(thumb).size(50, 50).pad(3); if ((itemIter - 7) % 4 == 0) { table.row(); } itemIter++; } addActor(container); }
From source file:com.uwsoft.editor.gdx.ui.ComponentList.java
License:Apache License
public ComponentList(final UIStage s, float width, float height) { this.setWidth(width); this.setHeight(height); final Table container = new Table(); Table table = new Table(); Group listContainer = new Group(); container.setX(0);/*from w ww . j a va 2 s .co m*/ container.setY(0); container.setWidth(getWidth() - 1); container.setHeight(getHeight() - 20); listContainer.setWidth(getWidth() - 20); listContainer.setHeight(getHeight() - 25); final ScrollPane scroll = new ScrollPane(table, s.textureManager.editorSkin); container.add(scroll).colspan(4).width(getWidth()); container.row(); scroll.addListener(new InputListener() { public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { event.stop(); return true; } }); scroll.setHeight(getHeight() - 20); scroll.setY(0); scroll.setFlickScroll(false); HashMap<String, String> components = new HashMap<String, String>(); components.put("Label", "Label"); components.put("TextBoxItem", "Text Field"); components.put("ButtonItem", "Text Button"); components.put("CheckBox", "CheckBox"); components.put("SelectBox", "SelectBox"); Label dummyTst = new Label("dummy", s.textureManager.editorSkin); if (components.size() * dummyTst.getHeight() > listContainer.getHeight()) listContainer.setHeight(components.size() * dummyTst.getHeight()); dummyTst = null; int iter = 1; for (final Object value : components.values()) { ComponentThumbnailBox thumb = new ComponentThumbnailBox(s, getWidth(), (String) value); thumb.setX(0); thumb.setY(listContainer.getHeight() - thumb.getHeight() * iter); listContainer.addActor(thumb); iter++; } table.add(listContainer); table.row(); addActor(container); }
From source file:com.uwsoft.editor.gdx.ui.LibraryList.java
License:Apache License
public LibraryList(final UIStage s, float width, float height) { stage = s;// w ww.j ava2s .com libraryItems = new ArrayList<>(); this.setWidth(width); this.setHeight(height); final Table container = new Table(); Table table = new Table(); listContainer = new Group(); container.setX(0); container.setY(0); container.setWidth(getWidth() - 1); container.setHeight(getHeight() - 20); listContainer.setWidth(getWidth() - 20); listContainer.setHeight(getHeight() - 25); final ScrollPane scroll = new ScrollPane(table, s.textureManager.editorSkin); container.add(scroll).colspan(4).width(getWidth()); container.row(); scroll.addListener(new InputListener() { public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { event.stop(); return true; } }); scroll.setHeight(getHeight() - 20); scroll.setY(0); scroll.setFlickScroll(false); items = s.getSandbox().sceneControl.getCurrentSceneVO().libraryItems; Label dummyTst = new Label("dummy", s.textureManager.editorSkin); if (items.size() * dummyTst.getHeight() > listContainer.getHeight()) { listContainer.setHeight(items.size() * (dummyTst.getHeight() + 2)); } drawItems(); table.add(listContainer); table.row(); addActor(container); }
From source file:com.uwsoft.editor.gdx.ui.ParticleList.java
License:Apache License
public ParticleList(final UIStage s, float width, float height) { this.setWidth(width); this.setHeight(height); final Table container = new Table(); Table table = new Table(); container.setX(0);/*from ww w . java2 s . c o m*/ container.setY(0); container.setWidth(getWidth() - 1); container.setHeight(getHeight() - 20); final ScrollPane scroll = new ScrollPane(table, s.textureManager.editorSkin); container.add(scroll).colspan(4).width(getWidth()); container.row(); scroll.addListener(new InputListener() { public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { event.stop(); return true; } }); scroll.setHeight(getHeight() - 20); scroll.setFlickScroll(false); // change to particle list HashMap<String, ParticleEffect> particles = s.textureManager.getProjectParticleList(); if (particles == null) return; int i = 0; for (String key : particles.keySet()) { final ParticleThumbnailBox thumb = new ParticleThumbnailBox(s, key); final String pname = key; table.add(thumb).pad(3); if ((i - 7) % 4 == 0) { table.row(); } i++; } addActor(container); }
From source file:com.uwsoft.editor.gdx.ui.UIItemsBox.java
License:Apache License
public void initContent() { for (int i = 0; i < this.getChildren().size; i++) { if (this.getChildren().get(i).getName() != null && this.getChildren().get(i).getName().equals("treeTable")) { this.getChildren().get(i).remove(); break; }/*from w w w . j a va 2 s. c o m*/ } skin = stage.textureManager.editorSkin; tree = new Tree(skin); CompositeItem sceneItems = stage.getSandbox().getCurrentScene(); Node root = addTree(sceneItems, stage.getCompositePanel().isRootScene()); for (int i = 0; i < sceneItems.getItems().size(); i++) { if (sceneItems.getItems().get(i).isComposite()) { innerComposite(sceneItems.getItems().get(i), root); } else { addTree(sceneItems.getItems().get(i), root); } } //expand root if (root != null && root.getChildren() != null && root.getChildren().size > 0 && root.getChildren().get(0) != null) { root.getChildren().get(0).expandTo(); } Table scrolltable = new Table(); scrolltable.padBottom(20); scrolltable.add(tree).fill().expand(); final ScrollPane scroller = new ScrollPane(scrolltable, skin); scroller.setFlickScroll(false); final Table table = new Table(); table.setFillParent(true); table.padTop(10); table.add(scroller).fill().expand(); table.setName("treeTable"); addActor(table); tree.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { Array<Node> selectedNodes = tree.getSelection().toArray(); for (int i = 0; i < selectedNodes.size; i++) { System.out.println(); IBaseItem baseItem = (IBaseItem) selectedNodes.get(i).getObject(); IBaseItem item = getCurrentSceneItem(stage.getSandbox().getCurrentScene(), baseItem); if (item != null) { addSelectionAction(item); } } } }); }
From source file:de.longri.cachebox3.develop.tools.skin_editor.actors.OptionsPane.java
License:Apache License
/** * *///w w w .java 2 s. c o m public OptionsPane(final SkinEditorGame game, PreviewPane previewPane) { super(); //this.setDebug(true); this.game = game; this.previewPane = previewPane; left(); top(); setBackground(game.skin.getDrawable("default-pane")); styleLabelCell = add(new Label("Styles", game.skin, "title")).pad(5); styleLabelCell.row(); styleLabelCellPrefHeight = styleLabelCell.getPrefHeight(); listStyles = new List<String>(game.skin, "dimmed"); listStyles.setItems(listItems); ScrollPane styleScrollPane = new ScrollPane(listStyles, game.skin); styleScrollPane.setFlickScroll(false); styleScrollPane.setFadeScrollBars(false); styleScrollPane.setScrollbarsOnTop(true); styleScrollPane.setScrollBarPositions(false, true); styleScrollPane.setScrollingDisabled(true, false); styleCell = add(styleScrollPane).height(200).expandX().fillX().pad(5); styleCell.row(); // Add buttons Table tableStylesButtons = new Table(); TextButton buttonNewStyle = new TextButton("New Style", game.skin); TextButton buttonDeleteStyle = new TextButton("Delete Style", game.skin); tableStylesButtons.add(buttonNewStyle).pad(5); tableStylesButtons.add(buttonDeleteStyle).pad(5); styleButtonCell = add(tableStylesButtons); styleButtonCell.row(); styleButtonCellPrefHeight = styleButtonCell.getPrefHeight(); // Callbacks listStyles.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { String key = (String) listStyles.getSelected(); if (key != null) { Gdx.app.log("OptionsPane", "Selected style: " + key); currentStyle = styles.get(key); updateTableFields(key); } } }); buttonNewStyle.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { createNewStyle(); } }); buttonDeleteStyle.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { showDeleteDialog(); } }); // Initialize table add(new Label("Fields", game.skin, "title")).pad(5).padTop(10).row(); tableFields = new Table(game.skin); tableFields.setBackground(game.skin.getDrawable("dialogDim")); tableFields.left().top(); ScrollPane scroll2 = new ScrollPane(tableFields, game.skin); scroll2.setFlickScroll(false); scroll2.setFadeScrollBars(false); scroll2.setScrollbarsOnTop(true); scroll2.setScrollBarPositions(false, true); scroll2.setScrollingDisabled(true, false); add(scroll2).pad(5).expand().fill(); this.layout(); }