diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c956535..3f91844d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,16 @@ FlatLaf Change Log ================== +## Unreleased + +#### New features and improvements + +- TabbedPane: Made tabs separator color lighter in dark themes so that it is + easier to recognize the tabbed pane. +- TabbedPane: Added top and bottom tab insets to avoid that large tab icons are + painted over active tab underline. + + ## 0.42 #### New features and improvements diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties index e56caeaf..3be323c2 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatDarkLaf.properties @@ -257,7 +257,7 @@ TabbedPane.underlineColor=#4A88C7 TabbedPane.disabledUnderlineColor=#7a7a7a TabbedPane.hoverColor=#2e3133 TabbedPane.focusColor=#3d4b5c -TabbedPane.contentAreaColor=#323232 +TabbedPane.contentAreaColor=#646464 #---- Table ---- diff --git a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties index cf608e79..0dd52686 100644 --- a/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties +++ b/flatlaf-core/src/main/resources/com/formdev/flatlaf/FlatLaf.properties @@ -539,7 +539,7 @@ TabbedPane.tabHeight=32 TabbedPane.tabSelectionHeight=3 TabbedPane.contentSeparatorHeight=1 TabbedPane.hasFullBorder=false -TabbedPane.tabInsets=0,12,0,12 +TabbedPane.tabInsets=4,12,4,12 TabbedPane.tabAreaInsets=0,0,0,0 TabbedPane.selectedTabPadInsets=0,0,0,0 TabbedPane.tabRunOverlay=0 diff --git a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt index 6052f589..5e3582df 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatDarkLaf_1.8.0_202.txt @@ -445,7 +445,7 @@ JideTabbedPane.foreground #bbbbbb javax.swing.plaf.ColorUIResource [UI] JideTabbedPane.shadow #3c3f41 javax.swing.plaf.ColorUIResource [UI] JideTabbedPane.tabAreaBackground #3c3f41 javax.swing.plaf.ColorUIResource [UI] JideTabbedPane.tabAreaInsets 0,0,0,0 javax.swing.plaf.InsetsUIResource [UI] -JideTabbedPane.tabInsets 0,12,0,12 javax.swing.plaf.InsetsUIResource [UI] +JideTabbedPane.tabInsets 4,12,4,12 javax.swing.plaf.InsetsUIResource [UI] JideTabbedPane.tabRunOverlay 0 JideTabbedPaneUI com.formdev.flatlaf.jideoss.ui.FlatJideTabbedPaneUI @@ -905,7 +905,7 @@ SplitPaneUI com.formdev.flatlaf.ui.FlatSplitPaneUI #---- TabbedPane ---- TabbedPane.background #3c3f41 javax.swing.plaf.ColorUIResource [UI] -TabbedPane.contentAreaColor #323232 javax.swing.plaf.ColorUIResource [UI] +TabbedPane.contentAreaColor #646464 javax.swing.plaf.ColorUIResource [UI] TabbedPane.contentOpaque true TabbedPane.contentSeparatorHeight 1 TabbedPane.darkShadow #7e7e7e javax.swing.plaf.ColorUIResource [UI] @@ -926,7 +926,7 @@ TabbedPane.selectionFollowsFocus true TabbedPane.shadow #3c3f41 javax.swing.plaf.ColorUIResource [UI] TabbedPane.tabAreaInsets 0,0,0,0 javax.swing.plaf.InsetsUIResource [UI] TabbedPane.tabHeight 32 -TabbedPane.tabInsets 0,12,0,12 javax.swing.plaf.InsetsUIResource [UI] +TabbedPane.tabInsets 4,12,4,12 javax.swing.plaf.InsetsUIResource [UI] TabbedPane.tabRunOverlay 0 TabbedPane.tabSelectionHeight 3 TabbedPane.tabsOpaque true diff --git a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt index a7676c87..cbe98e76 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatLightLaf_1.8.0_202.txt @@ -450,7 +450,7 @@ JideTabbedPane.foreground #000000 javax.swing.plaf.ColorUIResource [UI] JideTabbedPane.shadow #f2f2f2 javax.swing.plaf.ColorUIResource [UI] JideTabbedPane.tabAreaBackground #f2f2f2 javax.swing.plaf.ColorUIResource [UI] JideTabbedPane.tabAreaInsets 0,0,0,0 javax.swing.plaf.InsetsUIResource [UI] -JideTabbedPane.tabInsets 0,12,0,12 javax.swing.plaf.InsetsUIResource [UI] +JideTabbedPane.tabInsets 4,12,4,12 javax.swing.plaf.InsetsUIResource [UI] JideTabbedPane.tabRunOverlay 0 JideTabbedPaneUI com.formdev.flatlaf.jideoss.ui.FlatJideTabbedPaneUI @@ -931,7 +931,7 @@ TabbedPane.selectionFollowsFocus true TabbedPane.shadow #f2f2f2 javax.swing.plaf.ColorUIResource [UI] TabbedPane.tabAreaInsets 0,0,0,0 javax.swing.plaf.InsetsUIResource [UI] TabbedPane.tabHeight 32 -TabbedPane.tabInsets 0,12,0,12 javax.swing.plaf.InsetsUIResource [UI] +TabbedPane.tabInsets 4,12,4,12 javax.swing.plaf.InsetsUIResource [UI] TabbedPane.tabRunOverlay 0 TabbedPane.tabSelectionHeight 3 TabbedPane.tabsOpaque true diff --git a/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt b/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt index 5c238ae8..5df27cff 100644 --- a/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt +++ b/flatlaf-testing/dumps/uidefaults/FlatTestLaf_1.8.0_202.txt @@ -438,7 +438,7 @@ JideTabbedPane.foreground #ff0000 javax.swing.plaf.ColorUIResource [UI] JideTabbedPane.shadow #ccffcc javax.swing.plaf.ColorUIResource [UI] JideTabbedPane.tabAreaBackground #ccffcc javax.swing.plaf.ColorUIResource [UI] JideTabbedPane.tabAreaInsets 0,0,0,0 javax.swing.plaf.InsetsUIResource [UI] -JideTabbedPane.tabInsets 0,12,0,12 javax.swing.plaf.InsetsUIResource [UI] +JideTabbedPane.tabInsets 4,12,4,12 javax.swing.plaf.InsetsUIResource [UI] JideTabbedPane.tabRunOverlay 0 JideTabbedPaneUI com.formdev.flatlaf.jideoss.ui.FlatJideTabbedPaneUI @@ -921,7 +921,7 @@ TabbedPane.selectionFollowsFocus true TabbedPane.shadow #ccffcc javax.swing.plaf.ColorUIResource [UI] TabbedPane.tabAreaInsets 0,0,0,0 javax.swing.plaf.InsetsUIResource [UI] TabbedPane.tabHeight 32 -TabbedPane.tabInsets 0,12,0,12 javax.swing.plaf.InsetsUIResource [UI] +TabbedPane.tabInsets 4,12,4,12 javax.swing.plaf.InsetsUIResource [UI] TabbedPane.tabRunOverlay 0 TabbedPane.tabSelectionHeight 3 TabbedPane.tabSeparatorColor #0000ff javax.swing.plaf.ColorUIResource [UI] diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatContainerTest.java b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatContainerTest.java index 3ebbaa3f..393fc1ec 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatContainerTest.java +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatContainerTest.java @@ -131,6 +131,27 @@ public class FlatContainerTest return tab; } + private void tabIconsChanged() { + boolean showTabIcons = tabIconsCheckBox.isSelected(); + + setTabIcons( tabbedPane1, showTabIcons ); + setTabIcons( tabbedPane2, showTabIcons ); + setTabIcons( tabbedPane3, showTabIcons ); + setTabIcons( tabbedPane4, showTabIcons ); + + tabIconSizeSpinner.setEnabled( showTabIcons ); + } + + private void setTabIcons( JTabbedPane tabbedPane, boolean showTabIcons ) { + Object iconSize = tabIconSizeSpinner.getValue(); + + Icon icon = showTabIcons + ? new ImageIcon( getClass().getResource( "/com/formdev/flatlaf/testing/test" + iconSize + ".png" ) ) + : null; + tabbedPane.setIconAt( 0, icon ); + tabbedPane.setIconAt( 1, icon ); + } + private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents JPanel panel9 = new JPanel(); @@ -154,6 +175,8 @@ public class FlatContainerTest tabScrollCheckBox = new JCheckBox(); showTabSeparatorsCheckBox = new JCheckBox(); hasFullBorderCheckBox = new JCheckBox(); + tabIconsCheckBox = new JCheckBox(); + tabIconSizeSpinner = new JSpinner(); CellConstraints cc = new CellConstraints(); //======== this ======== @@ -262,7 +285,9 @@ public class FlatContainerTest "[]" + "[]" + "[]" + - "[]", + "[]" + + "[fill]" + + "[fill]", // rows "[center]")); @@ -287,6 +312,17 @@ public class FlatContainerTest hasFullBorderCheckBox.setText("Show content border"); hasFullBorderCheckBox.addActionListener(e -> hasFullBorderChanged()); panel14.add(hasFullBorderCheckBox, "cell 3 0,alignx left,growx 0"); + + //---- tabIconsCheckBox ---- + tabIconsCheckBox.setText("Tab icons"); + tabIconsCheckBox.addActionListener(e -> tabIconsChanged()); + panel14.add(tabIconsCheckBox, "cell 4 0"); + + //---- tabIconSizeSpinner ---- + tabIconSizeSpinner.setModel(new SpinnerListModel(new String[] {"16", "24", "32", "48", "64"})); + tabIconSizeSpinner.setEnabled(false); + tabIconSizeSpinner.addChangeListener(e -> tabIconsChanged()); + panel14.add(tabIconSizeSpinner, "cell 5 0"); } panel9.add(panel14, cc.xywh(1, 11, 3, 1)); } @@ -303,6 +339,8 @@ public class FlatContainerTest private JCheckBox tabScrollCheckBox; private JCheckBox showTabSeparatorsCheckBox; private JCheckBox hasFullBorderCheckBox; + private JCheckBox tabIconsCheckBox; + private JSpinner tabIconSizeSpinner; // JFormDesigner - End of variables declaration //GEN-END:variables //---- class Tab1Panel ---------------------------------------------------- diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatContainerTest.jfd b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatContainerTest.jfd index fa48ce4f..04bffb81 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatContainerTest.jfd +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatContainerTest.jfd @@ -1,4 +1,4 @@ -JFDML JFormDesigner: "7.0.2.0.298" Java: "14" encoding: "UTF-8" +JFDML JFormDesigner: "7.0.2.0.298" Java: "15" encoding: "UTF-8" new FormModel { contentType: "form/swing" @@ -131,7 +131,7 @@ new FormModel { } ) add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { "$layoutConstraints": "insets 0,hidemode 3" - "$columnConstraints": "[][][][]" + "$columnConstraints": "[][][][][fill][fill]" "$rowConstraints": "[center]" } ) { name: "panel14" @@ -178,6 +178,35 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 3 0,alignx left,growx 0" } ) + add( new FormComponent( "javax.swing.JCheckBox" ) { + name: "tabIconsCheckBox" + "text": "Tab icons" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabIconsChanged", false ) ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 4 0" + } ) + add( new FormComponent( "javax.swing.JSpinner" ) { + name: "tabIconSizeSpinner" + "model": new javax.swing.SpinnerListModel { + list: new java.util.ArrayList { + add( "16" ) + add( "24" ) + add( "32" ) + add( "48" ) + add( "64" ) + } + } + "enabled": false + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + addEvent( new FormEvent( "javax.swing.event.ChangeListener", "stateChanged", "tabIconsChanged", false ) ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 5 0" + } ) }, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) { "gridY": 11 "gridWidth": 3