diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/io/github/cottonmc/cotton/gui/widget/WTabPanel.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WTabPanel.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WTabPanel.java index 543758e..dd11eaf 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WTabPanel.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WTabPanel.java @@ -144,7 +144,7 @@ public class WTabPanel extends WPanel { public WTabPanel setSelectedIndex(int tabIndex) { mainPanel.setSelectedIndex(tabIndex); - for (int i = 0; i < tabWidgets.size(); i++) { + for (int i = 0; i < getTabCount(); i++) { tabWidgets.get(i).selected = (i == tabIndex); } @@ -152,6 +152,14 @@ public class WTabPanel extends WPanel { return this; } + /** + * {@return the number of tabs in this tab panel} + * @since 6.3.0 + */ + public int getTabCount() { + return tabWidgets.size(); + } + @Override public void setSize(int x, int y) { super.setSize(x, y); |