diff options
author | Juuz <6596629+Juuxel@users.noreply.github.com> | 2022-09-14 17:25:14 +0300 |
---|---|---|
committer | Juuz <6596629+Juuxel@users.noreply.github.com> | 2022-09-14 17:25:14 +0300 |
commit | 67635ab3472a4e23721226513b57a1fa63001b2c (patch) | |
tree | 58e17e72ca627f5131057736f8dfdbf3557d8cc4 /src/main/java | |
parent | 2f76b8aeb0fccb0e032adfd996a687e1aa70e854 (diff) | |
download | LibGui-67635ab3472a4e23721226513b57a1fa63001b2c.tar.gz LibGui-67635ab3472a4e23721226513b57a1fa63001b2c.tar.bz2 LibGui-67635ab3472a4e23721226513b57a1fa63001b2c.zip |
WTabPanel: Add method for accessing tab count
Diffstat (limited to 'src/main/java')
-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); |