Example usage for com.badlogic.gdx.scenes.scene2d.ui Cell padBottom

List of usage examples for com.badlogic.gdx.scenes.scene2d.ui Cell padBottom

Introduction

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

Prototype

public Cell<T> padBottom(float padBottom) 

Source Link

Usage

From source file:com.forerunnergames.peril.client.ui.widgets.Widgets.java

License:Open Source License

public static void padCell(final Cell<?> cell, final float paddingAmount, final CellPadding paddingType) {
    Arguments.checkIsNotNull(cell, "cell");
    Arguments.checkIsNotNegative(paddingAmount, "paddingAmount");
    Arguments.checkIsNotNull(paddingType, "paddingType");

    switch (paddingType) {
    case LEFT: {/*from   ww  w. ja  va2 s .c  om*/
        cell.padLeft(paddingAmount);
        break;
    }
    case RIGHT: {
        cell.padRight(paddingAmount);
        break;
    }
    case TOP: {
        cell.padTop(paddingAmount);
        break;
    }
    case BOTTOM: {
        cell.padBottom(paddingAmount);
        break;
    }
    case ALL: {
        cell.pad(paddingAmount);
    }
    default: {
        throw new IllegalStateException(
                "Unknown " + CellPadding.class.getSimpleName() + " value [" + paddingType + "]");
    }
    }
}

From source file:com.vlaaad.dice.ui.windows.DiceWindow.java

License:Open Source License

@Override
protected void doShow(final UserData userData) {
    final Table items = new Table();
    final ScrollPane pane = new ScrollPane(items, new ScrollPane.ScrollPaneStyle()) {

        @Override/*ww w  .  j ava 2s. com*/
        public void layout() {
            float w = items.getPrefWidth();
            float h = Math.min(getParent().getHeight(), items.getPrefHeight());
            if (w != getWidth() || h != getHeight()) {
                setSize(w, h);
                invalidateHierarchy();
            }
            super.layout();
        }
    };
    pane.setTouchable(Touchable.childrenOnly);
    pane.setOverscroll(false, false);
    pane.setCancelTouchFocus(false);
    pane.addListener(new ChangeListener() {

        @Override
        public void changed(ChangeEvent event, Actor actor) {
            pane.layout();
            pane.layout();
            items.layout();
            if (actor instanceof Layout)
                ((Layout) actor).layout();
            pane.layout();
            pane.layout();
            pane.scrollTo(actor.getX(), actor.getY(), actor.getWidth(), actor.getHeight() + 100);
        }
    });

    Iterable<Die> dice = userData.dice();
    int i = 1;
    int count = userData.diceCount();
    for (Die die : dice) {
        DiePane diePane = new DiePane(die, userData, diceWindowGroup);
        table.add(diePane);
        diePane.setWidth(0);
        diePane.pack();
        diePane.setWidth(ViewController.CELL_SIZE * 6.6f);
        Cell cell = items.add(diePane).fillX().maxWidth(ViewController.CELL_SIZE * 6.6f);
        if (i != count) {
            cell.padBottom(-1);
        }
        cell.row();
        map.put(die, diePane);
        diePane.info.addListener(createMinimizeListener(die, dice));
        i++;
    }
    items.pack();
    table.add(pane).width(items.getPrefWidth());//.size(items.getPrefWidth(), 200);
}