List of usage examples for com.badlogic.gdx.scenes.scene2d.ui Cell getActor
public T getActor()
From source file:com.badlogic.gdx.ai.tests.utils.scene2d.TabbedPane.java
License:Apache License
private void initialize() { setTouchable(Touchable.enabled);/*from w w w. jav a 2 s . c o m*/ tabTitleTable = new Table(); tabBodyStack = new Stack(); selectedIndex = -1; // Create 1st row Cell<?> leftCell = add(new Image(style.titleBegin)); Cell<?> midCell = add(tabTitleTable); Cell<?> rightCell = add(new Image(style.titleEnd)); switch (tabTitleAlign) { case Align.left: leftCell.width(((Image) leftCell.getActor()).getWidth()).bottom(); midCell.left(); rightCell.expandX().fillX().bottom(); break; case Align.right: leftCell.expandX().fillX().bottom(); midCell.right(); rightCell.width(((Image) rightCell.getActor()).getWidth()).bottom(); break; case Align.center: leftCell.expandX().fillX().bottom(); midCell.center(); rightCell.expandX().fillX().bottom(); break; default: throw new IllegalArgumentException("TabbedPane align must be one of left, center, right"); } // Create 2nd row row(); Table t = new Table(); t.setBackground(style.bodyBackground); t.add(tabBodyStack); add(t).colspan(3).expand().fill(); }
From source file:com.crashinvaders.common.scene2d.visui.ToastManager.java
License:Apache License
/** Displays basic toast with provided text as message. Toast will be displayed for given amount of seconds. */ public Toast show(String text, float timeSec) { VisTable table = new VisTable(); Cell<Label> cell = table.add(text).grow(); cell.getActor().setTouchable(Touchable.disabled); return show(table, timeSec); }
From source file:com.forerunnergames.peril.client.ui.widgets.messagebox.DefaultMessageBox.java
License:Open Source License
@Override public T getRowByIndex(final int index) { Arguments.checkIsTrue(hasRowWithIndex(index), "Row does not exist with index [{}].", index); final Cell<?> cell = table.getCells().get(index); final Actor actor = cell.getActor(); if (actor == null) { throw new IllegalStateException( Strings.format("Row with index [{}] is invalid (actor is null).", index)); }/*from w ww . j a v a 2 s . c o m*/ final T row = rowCache.get(actor); if (row == null) { throw new IllegalStateException(Strings.format("Row with index [{}] is invalid (row is null).", index)); } return row; }
From source file:com.lyeeedar.UI.TabPanel.java
License:Apache License
private void initialize() { setTouchable(Touchable.enabled);/*from w ww .j a va 2 s. com*/ tabTitleTable = new Table(); tabBodyStack = new Stack(); selectedIndex = -1; // Create 1st row Cell<?> leftCell = add(new Image(style.titleBegin)); Cell<?> midCell = add(tabTitleTable); Cell<?> rightCell = add(new Image(style.titleEnd)); switch (tabTitleAlign) { case Align.left: leftCell.width(leftCell.getActor().getWidth()).bottom(); midCell.left(); rightCell.expandX().fillX().bottom(); break; case Align.right: leftCell.expandX().fillX().bottom(); midCell.right(); rightCell.width(rightCell.getActor().getWidth()).bottom(); break; case Align.center: leftCell.expandX().fillX().bottom(); midCell.center(); rightCell.expandX().fillX().bottom(); break; default: throw new IllegalArgumentException("TabbedPane align must be one of left, center, right"); } // Create 2nd row row(); Table t = new Table(); t.setBackground(style.bodyBackground); t.add(tabBodyStack).expand().fill(); add(t).colspan(3).expand().fill(); }
From source file:es.eucm.ead.editor.view.widgets.draw.ColorPickerPanel.java
License:Open Source License
private boolean hasPickedColor() { for (Cell cell : colors.getCells()) { Actor actor = cell.getActor(); if (actor.getColor().equals(picker.getPickedColor())) { return true; }//from www. ja v a 2 s . c o m } return false; }
From source file:Roguelike.UI.TabPanel.java
License:Apache License
private void initialize() { setTouchable(Touchable.enabled);/*from ww w . jav a 2s . co m*/ tabTitleTable = new Table(); tabBodyStack = new Stack(); selectedIndex = -1; // Create 1st row Cell<?> leftCell = add(new Image(style.titleBegin)); Cell<?> midCell = add(tabTitleTable); Cell<?> rightCell = add(new Image(style.titleEnd)); switch (tabTitleAlign) { case Align.left: leftCell.width(((Image) leftCell.getActor()).getWidth()).bottom(); midCell.left(); rightCell.expandX().fillX().bottom(); break; case Align.right: leftCell.expandX().fillX().bottom(); midCell.right(); rightCell.width(((Image) rightCell.getActor()).getWidth()).bottom(); break; case Align.center: leftCell.expandX().fillX().bottom(); midCell.center(); rightCell.expandX().fillX().bottom(); break; default: throw new IllegalArgumentException("TabbedPane align must be one of left, center, right"); } // Create 2nd row row(); Table t = new Table(); t.setBackground(style.bodyBackground); t.add(tabBodyStack).expand().fill(); add(t).colspan(3).expand().fill(); }