Example usage for com.badlogic.gdx.scenes.scene2d.ui ScrollPane setForceScroll

List of usage examples for com.badlogic.gdx.scenes.scene2d.ui ScrollPane setForceScroll

Introduction

In this page you can find the example usage for com.badlogic.gdx.scenes.scene2d.ui ScrollPane setForceScroll.

Prototype

public void setForceScroll(boolean x, boolean y) 

Source Link

Document

Forces enabling scrollbars (for non-flick scroll) and overscrolling (for flick scroll) in a direction, even if the contents do not exceed the bounds in that direction.

Usage

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  .  jav a 2s  .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;
}