this.stage = stage;\r
}\r
\r
- /** Returns true if the specified actor is this actor or a descendant of this actor. */\r
- public boolean isDescendant (Actor actor) {\r
+ /** Returns true if this actor is the same as or is the descendant of the specified actor. */\r
+ public boolean isDescendantOf (Actor actor) {\r
if (actor == null) throw new IllegalArgumentException("actor cannot be null.");\r
Actor parent = this;\r
while (true) {\r
}\r
}\r
\r
- /** Returns true if the specified actor is this actor or an ancestor of this actor. */\r
- public boolean isAscendant (Actor actor) {\r
+ /** Returns true if this actor is the same as or is the ascendant of the specified actor. */\r
+ public boolean isAscendantOf (Actor actor) {\r
if (actor == null) throw new IllegalArgumentException("actor cannot be null.");\r
while (true) {\r
if (actor == null) return false;\r
return add(new Label(text, skin.get(labelStyleName, LabelStyle.class)));\r
}\r
\r
+ /** Adds a new cell with a label. This may only be called if {@link Table#Table(Skin)} or {@link #setSkin(Skin)} was used. */\r
+ public Cell add (String text, String fontName, Color color) {\r
+ if (skin == null) throw new IllegalStateException("Table must have a skin set to use this method.");\r
+ return add(new Label(text, new LabelStyle(skin.getFont(fontName), color)));\r
+ }\r
+\r
+ /** Adds a new cell with a label. This may only be called if {@link Table#Table(Skin)} or {@link #setSkin(Skin)} was used. */\r
+ public Cell add (String text, String fontName, String colorName) {\r
+ if (skin == null) throw new IllegalStateException("Table must have a skin set to use this method.");\r
+ return add(new Label(text, new LabelStyle(skin.getFont(fontName), skin.getColor(colorName))));\r
+ }\r
+\r
/** Adds a cell without a widget. */\r
public Cell add () {\r
return layout.add(null);\r
\r
public TextButton (String text, Skin skin) {\r
this(text, skin.get(TextButtonStyle.class));\r
+ setSkin(skin);\r
}\r
\r
public TextButton (String text, Skin skin, String styleName) {\r
this(text, skin.get(styleName, TextButtonStyle.class));\r
+ setSkin(skin);\r
}\r
\r
public TextButton (String text, TextButtonStyle style) {\r
\r
public void exit (InputEvent event, float x, float y, int pointer, Actor toActor) {\r
super.exit(event, x, y, pointer, toActor);\r
- if (toActor == null || !toActor.isDescendant(Tree.this)) setOverNode(null);\r
+ if (toActor == null || !toActor.isDescendantOf(Tree.this)) setOverNode(null);\r
}\r
});\r
}\r
/** Returns true if the specified position is over the specified actor or within the tap square. */\r
public boolean isOver (Actor actor, float x, float y) {\r
Actor hit = actor.hit(x, y, true);\r
- if (hit == null || !hit.isDescendant(actor)) {\r
+ if (hit == null || !hit.isDescendantOf(actor)) {\r
if (touchDownX == -1 && touchDownY == -1) return false;\r
return Math.abs(x - touchDownX) < tapSquareSize && Math.abs(y - touchDownY) < tapSquareSize;\r
}\r
if (hit != null) {
for (int i = 0, n = targets.size; i < n; i++) {
Target target = targets.get(i);
- if (!target.actor.isAscendant(hit)) continue;
+ if (!target.actor.isAscendantOf(hit)) continue;
newTarget = target;
target.actor.stageToLocalCoordinates(Vector2.tmp.set(event.getStageX(), event.getStageY()));
isValidTarget = target.drag(source, payload, Vector2.tmp.x, Vector2.tmp.y, pointer);