List of usage examples for com.badlogic.gdx.scenes.scene2d.ui ScrollPane setFlickScroll
public void setFlickScroll(boolean flickScroll)
From source file:org.shadebob.skineditor.dialog.ColorPickerDialog.java
License:Apache License
public ColorPickerDialog(final SkinEditorGame game, final Field field) { super("Color Picker", game.skin); this.game = game; this.field = field; tableColors = new Table(game.skin); tableColors.left().top().pad(5);/*from w w w. j a v a2 s.c o m*/ tableColors.defaults().pad(5); updateTable(); ScrollPane scrollPane = new ScrollPane(tableColors, game.skin); scrollPane.setFlickScroll(false); scrollPane.setFadeScrollBars(false); scrollPane.setScrollbarsOnTop(true); getContentTable().add(scrollPane).width(540).height(320).pad(20); getButtonTable().add(new TextButton("New Color", game.skin)).getActor().addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { SwingUtils.forceFocus(); // Call swing color picker java.awt.Color color = JColorChooser.showDialog(null, "Pick your color", java.awt.Color.WHITE); if (color != null) { String colorName = JOptionPane.showInputDialog("Name your color"); if ((colorName != null) && (colorName.isEmpty() == false)) { // Verify if the color name is already in use if (colors.containsKey(colorName) == true) { game.showNotice("Error", "Color name already in use!", game.screenMain.stage); } else { // Add the color (asuming RGBA) float[] components = color.getComponents(null); Color newColor = new Color(components[0], components[1], components[2], components[3]); if (CustomSkin.isResInUse(game.skinProject, newColor)) { game.showNotice("Error", "Same color value (" + newColor.toString() + ") is already defined with a different name!", game.screenMain.stage); return; } colors.put(colorName, newColor); game.screenMain.changeSkin(); // update table updateTable(); } } } } }); ; if (field != null) { getButtonTable().add(new TextButton("Empty Color", game.skin)).getActor() .addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { try { field.set(game.screenMain.paneOptions.currentStyleObj, null); } catch (Exception e) { e.printStackTrace(); } game.screenMain.changeSkin(); hide(); game.screenMain.panePreview.refresh(); game.screenMain.paneOptions.updateSelectedTableFields(); } }); } button("Cancel", false).key(Keys.ESCAPE, false).getButtonTable().padBottom(15); }
From source file:org.shadebob.skineditor.dialog.FontPickerDialog.java
License:Apache License
public FontPickerDialog(final SkinEditorGame game, Field field) { super("Bitmap Font Picker", game.skin); this.game = game; this.field = field; tableFonts = new Table(game.skin); tableFonts.left().top().pad(5);/*ww w. ja v a 2 s. c om*/ tableFonts.defaults().pad(5); updateTable(); ScrollPane scrollPane = new ScrollPane(tableFonts, game.skin); scrollPane.setFlickScroll(false); scrollPane.setFadeScrollBars(false); scrollPane.setScrollbarsOnTop(true); getContentTable().add(scrollPane).width(720).height(420).pad(20); button("Cancel", false).key(Keys.ESCAPE, false).getButtonTable().padBottom(15); }