Skip to content

Commit 4319ce9

Browse files
committed
Added ToggleGroup.
1 parent 399d026 commit 4319ce9

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

CHANGES.md

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* Updated to libGDX 1.12.1
33
* Updated source compatibility to Java 8
44
* Added CollapsibleGroup
5+
* Added ToggleGroup
56
* Fixed KeepSizedWithinStage in PopTable
67
* Fixed issues with PopTable focus
78
* Other minor PopTable bug fixes
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package com.ray3k.stripe;
2+
3+
import com.badlogic.gdx.scenes.scene2d.ui.Container;
4+
import com.badlogic.gdx.scenes.scene2d.ui.Table;
5+
6+
/**
7+
* A layout widget that can be programmatically changed to display one of two tables. This is useful in user interfaces
8+
* that need to display alternate layouts depending on certain criteria.
9+
*/
10+
public class ToggleGroup extends Container<Table> {
11+
public Table table1 = new Table();
12+
public Table table2 = new Table();
13+
public boolean showingTable1;
14+
15+
public ToggleGroup() {
16+
showTable1();
17+
fill();
18+
}
19+
20+
public void showTable1() {
21+
setActor(table1);
22+
showingTable1 = true;
23+
}
24+
25+
public void showTable2() {
26+
setActor(table2);
27+
showingTable1 = false;
28+
}
29+
30+
public void swap() {
31+
if (showingTable1) showTable2();
32+
else showTable1();
33+
}
34+
35+
@Override @Deprecated
36+
public void setActor(Table table) {
37+
super.setActor(table);
38+
}
39+
}

0 commit comments

Comments
 (0)