List of usage examples for com.badlogic.gdx.math Rectangle setY
public Rectangle setY(float y)
From source file:com.forerunnergames.peril.client.ui.widgets.messagebox.DefaultMessageBox.java
License:Open Source License
public DefaultMessageBox(final MessageBoxStyle style, final WidgetFactory widgetFactory) { Arguments.checkIsNotNull(style, "style"); Arguments.checkIsNotNull(widgetFactory, "widgetFactory"); this.style = style; this.widgetFactory = widgetFactory; table = new Table(); configureTable();//w ww . java 2 s .c om scrollPane = new ScrollPane(table, widgetFactory.createScrollPaneStyle(style.getScrollPaneStyle(), style.getScrollbarStyle())) { private final int scissorsDeltaY = 2 + DefaultMessageBox.this.style.getScrollPaddingBottom(); private final int scissorsDeltaHeight = 1 - DefaultMessageBox.this.style.getScrollPaddingTop() - DefaultMessageBox.this.style.getScrollPaddingBottom(); @Override protected void drawChildren(final Batch batch, final float parentAlpha) { final Rectangle scissors = ScissorStack.popScissors(); scissors.setY(scissors.getY() + scissorsDeltaY); scissors.setHeight(scissors.getHeight() + scissorsDeltaHeight); ScissorStack.pushScissors(scissors); super.drawChildren(batch, parentAlpha); } }; scrollPane.setOverscroll(false, false); scrollPane.setFlickScroll(true); scrollPane.setForceScroll(false, style.areScrollbarsRequired()); scrollPane.setFadeScrollBars(false); scrollPane.setScrollingDisabled(true, false); scrollPane.setScrollBarPositions(true, true); scrollPane.setScrollbarsOnTop(false); scrollPane.setSmoothScrolling(true); scrollPane.setVariableSizeKnobs(true); scrollPane.addListener(new InputListener() { @Override public void enter(final InputEvent event, final float x, final float y, final int pointer, final Actor fromActor) { if (scrollPane.getStage() == null) return; scrollPane.getStage().setScrollFocus(scrollPane); } @Override public void exit(final InputEvent event, final float x, final float y, final int pointer, final Actor toActor) { if (scrollPane.getStage() == null) return; scrollPane.getStage().setScrollFocus(null); } }); }