public static Table setupScrollpane( float x, float y, float paneWidth, float paneHeight, ScrollPane target, Texture scrollButton) { ScrollPane.ScrollPaneStyle scrollPaneStyle = new ScrollPane.ScrollPaneStyle(); scrollPaneStyle.vScrollKnob = new TextureRegionDrawable(new TextureRegion(scrollButton)); target.setStyle(scrollPaneStyle); target.setFadeScrollBars(false); target.setOverscroll(false, false); target.setFlickScroll(false); target.addListener(new GetScrollFocusWhenEntered(target)); Table scenarioPaneContainer = new Table(); scenarioPaneContainer.setX(x); scenarioPaneContainer.setY(y); scenarioPaneContainer.setWidth(paneWidth); scenarioPaneContainer.setHeight(paneHeight); scenarioPaneContainer.add(target).fill().expand(); return scenarioPaneContainer; }
protected CollapsableWindow addBehaviorSelectionWindow( String title, List<String> testList, float x, float y) { CollapsableWindow window = new CollapsableWindow(title, skin); window.row(); ScrollPane pane = new ScrollPane(testList, skin); pane.setFadeScrollBars(false); pane.setScrollX(0); pane.setScrollY(0); window.add(pane); window.pack(); window.pack(); if (window.getHeight() > stage.getHeight()) { window.setHeight(stage.getHeight()); } window.setX(x < 0 ? stage.getWidth() - (window.getWidth() - (x + 1)) : x); window.setY(y < 0 ? stage.getHeight() - (window.getHeight() - (y + 1)) : y); window.layout(); window.collapse(); stage.addActor(window); return window; }
void initialize() { skin.getFont("default").getData().markupEnabled = true; for (int i = 0; i < 6; i++) trackButtons.add(new TextButton(i + "", skin, "toggle")); animationList.getSelection().setRequired(false); premultipliedCheckbox.setChecked(true); loopCheckbox.setChecked(true); scaleSlider.setValue(1); scaleSlider.setSnapToValues(new float[] {1, 1.5f, 2, 2.5f, 3, 3.5f}, 0.01f); mixSlider.setValue(0.3f); mixSlider.setSnapToValues(new float[] {1, 1.5f, 2, 2.5f, 3, 3.5f}, 0.1f); speedSlider.setValue(1); speedSlider.setSnapToValues(new float[] {0.5f, 0.75f, 1, 1.25f, 1.5f, 2, 2.5f}, 0.1f); alphaSlider.setValue(1); alphaSlider.setDisabled(true); window.setMovable(false); window.setResizable(false); window.setKeepWithinStage(false); window.setX(-3); window.setY(-2); window.getTitleLabel().setColor(new Color(0.76f, 1, 1, 1)); window.getTitleTable().add(openButton).space(3); window.getTitleTable().add(minimizeButton).width(20); skinScroll.setFadeScrollBars(false); animationScroll.setFadeScrollBars(false); }
private void setSP(ScrollPane sp) { ScrollPaneStyle aux_st = sp.getStyle(); TextureRegion bg = new TextureRegion(Textures.scroll_box_bg, 0, 0, 256, 512); TextureRegionDrawable bg_d = new TextureRegionDrawable(bg); aux_st.background = bg_d; aux_st.vScroll = null; sp.setStyle(aux_st); sp.setHeight(415); sp.setWidth(212); sp.setSmoothScrolling(true); sp.setFadeScrollBars(true); sp.setFlickScroll(false); sp.setScrollbarsOnTop(true); sp.setupFadeScrollBars(2, 1.5f); }
public void createWindow() { Skin skin = new Skin(Gdx.files.internal("data/uiskin.json")); TextButton closeButton = new TextButton("", skin, "close-toggle"); Random random = new Random(); dialog = new Window("Terminal", skin); dialog.setBounds(10 + random.nextInt(50), 100 + random.nextInt(50), 400, 200); dialog.setResizable(true); dialog.setKeepWithinStage(true); dialog .getTitleTable() .add(closeButton) .size(dialog.getPadTop() * 4 / 5, dialog.getPadTop() * 4 / 5) .padRight(dialog.getPadRight()); dialog.left().top(); dialog.setResizeBorder(5); dialog.padRight(0); dialog.padBottom(1); SimpleDateFormat simpleDateformat = new SimpleDateFormat("E"); String day = simpleDateformat.format(new Date()); String month = new SimpleDateFormat("MMM").format(Calendar.getInstance().getTime()); int date = Calendar.getInstance().get(Calendar.DAY_OF_MONTH); int hour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY); int min = Calendar.getInstance().get(Calendar.MINUTE); int sec = Calendar.getInstance().get(Calendar.SECOND); String textTest = "Last login: "******" " + month + " " + String.format("%02d", date) + " " + String.format("%02d", hour) + ":" + String.format("%02d", min) + ":" + String.format("%02d", sec); cld.textHistory = textTest; consoleDialog = new Label(cld.textHistory, skin); consoleDialog.setWrap(true); consoleDialog.setAlignment(Align.topLeft, Align.topLeft); consoleArrow = new Label(cld.parser.getInputPrefix(), new LabelStyle(skin.get(LabelStyle.class))); consoleField = new TextField("", skin); consoleField.setFocusTraversal(false); Color colour = Color.ORANGE; colour.a = 0.8f; consoleField.getStyle().cursor = skin.newDrawable("white", colour); consoleField.getStyle().cursor.setMinWidth(10); consoleField.setBlinkTime(0.6f); Table scrollTable = new Table(); scrollTable.top(); scrollTable.add(consoleDialog).colspan(2).growX().fill().left().top(); scrollTable.row(); scrollTable.add(consoleArrow).left().top(); scrollTable.add(consoleField).expand(true, false).fill().left().top(); scrollTable.padBottom(1); consoleScroll = new ScrollPane(scrollTable, skin); consoleScroll.setFadeScrollBars(false); consoleScroll.setVariableSizeKnobs(true); consoleScroll.setFlickScroll(false); dialog.add(consoleScroll).fill().expand(); this.stage.addActor(dialog); closeButton.addListener(new CLICloseButtonListener(this, dialog)); setKeyboardFocus(); }