diff --git a/CHANGELOG.md b/CHANGELOG.md index fdb8a348..c0df05cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,14 +12,16 @@ FlatLaf Change Log and "One Dark" themes. - TabbedPane: Support hiding tab area if it contains only one tab. (set client property `JTabbedPane.hideTabAreaWithOneTab` to `true`) -- Table: Do not paint last vertical grid line if auto-resize mode is not off. - (issue #46) -- Table: Fixed unstable grid line thickness when scaled on HiDPI screens. (issue - #152) #### Fixed bugs +- Table: Do not paint last vertical grid line if auto-resize mode is not off. + (issue #46) +- Table: Fixed unstable grid line thickness when scaled on HiDPI screens. (issue + #152) +- TabbedPane: No longer add (internal) tab close button component as child to + `JTabbedPane`. (issue #219) - Custom window decorations: Title bar was not hidden if window is in full-screen mode. (issue #212) 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 7438dbf7..05a8df66 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 @@ -362,11 +362,6 @@ public class FlatTabbedPaneUI protected void installComponents() { super.installComponents(); - // create tab close button - tabCloseButton = new TabCloseButton(); - tabCloseButton.setVisible( false ); - tabPane.add( tabCloseButton ); - // find scrollable tab viewport tabViewport = null; if( isScrollTabLayout() ) { @@ -393,11 +388,7 @@ public class FlatTabbedPaneUI super.uninstallComponents(); - if( tabCloseButton != null ) { - tabPane.remove( tabCloseButton ); - tabCloseButton = null; - } - + tabCloseButton = null; tabViewport = null; } @@ -934,6 +925,12 @@ public class FlatTabbedPaneUI } protected void paintTabCloseButton( Graphics g, int tabIndex, int x, int y, int w, int h ) { + // create tab close button + if( tabCloseButton == null ) { + tabCloseButton = new TabCloseButton(); + tabCloseButton.setVisible( false ); + } + // update state of tab close button boolean rollover = (tabIndex == getRolloverTab()); ButtonModel bm = tabCloseButton.getModel();