From ec4343ed3057bdccfab06be6d7f9164aa4da15ab Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Sat, 3 Aug 2024 00:00:00 +0200 Subject: [PATCH] TabbedPane: fixed `ArrayIndexOutOfBoundsException` in case of using "card" tab type and using a custom tab selection model that returns -1 for selected tab (issue #875) --- .../src/main/java/com/formdev/flatlaf/ui/FlatTabbedPaneUI.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTabbedPaneUI.java b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTabbedPaneUI.java index 0d65f17fa..c28108205 100644 --- a/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTabbedPaneUI.java +++ b/flatlaf-core/src/main/java/com/formdev/flatlaf/ui/FlatTabbedPaneUI.java @@ -1685,7 +1685,7 @@ protected void paintContentBorder( Graphics g, int tabPlacement, int selectedInd w - (ci.left / 100f) - (ci.right / 100f), h - (ci.top / 100f) - (ci.bottom / 100f) ), false ); // add gap for selected tab to path - if( getTabType() == TAB_TYPE_CARD ) { + if( getTabType() == TAB_TYPE_CARD && selectedIndex >= 0 ) { float csh = scale( (float) contentSeparatorHeight ); Rectangle tabRect = getTabBounds( tabPane, selectedIndex );