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 9dcf9194..18d5325f 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 @@ -232,6 +232,26 @@ public class FlatContainerTest return tab; } + private void htmlTabsChanged() { + htmlTabsChanged( tabbedPane1 ); + htmlTabsChanged( tabbedPane2 ); + htmlTabsChanged( tabbedPane3 ); + htmlTabsChanged( tabbedPane4 ); + } + + private void htmlTabsChanged( JTabbedPane tabbedPane ) { + boolean html = htmlTabsCheckBox.isSelected(); + boolean multiLine = multiLineTabsCheckBox.isSelected(); + String s = multiLine + ? "Bold Tab
Second Line " + : (html ? "Bold Tab " : "Tab "); + int tabCount = tabbedPane.getTabCount(); + if( tabCount > 0 ) + tabbedPane.setTitleAt( 0, s + "1" ); + if( tabCount > 3 ) + tabbedPane.setTitleAt( 3, s + "4" ); + } + private void tabPlacementChanged() { int tabPlacement = -1; switch( (String) tabPlacementField.getSelectedItem() ) { @@ -394,6 +414,8 @@ public class FlatContainerTest JLabel tabCountLabel = new JLabel(); tabCountSpinner = new JSpinner(); customTabsCheckBox = new JCheckBox(); + htmlTabsCheckBox = new JCheckBox(); + multiLineTabsCheckBox = new JCheckBox(); JLabel hiddenTabsNavigationLabel = new JLabel(); hiddenTabsNavigationField = new JComboBox<>(); tabBackForegroundCheckBox = new JCheckBox(); @@ -560,6 +582,16 @@ public class FlatContainerTest customTabsCheckBox.addActionListener(e -> customTabsChanged()); tabbedPaneControlPanel.add(customTabsCheckBox, "cell 2 0"); + //---- htmlTabsCheckBox ---- + htmlTabsCheckBox.setText("HTML"); + htmlTabsCheckBox.addActionListener(e -> htmlTabsChanged()); + tabbedPaneControlPanel.add(htmlTabsCheckBox, "cell 2 0"); + + //---- multiLineTabsCheckBox ---- + multiLineTabsCheckBox.setText("multi-line"); + multiLineTabsCheckBox.addActionListener(e -> htmlTabsChanged()); + tabbedPaneControlPanel.add(multiLineTabsCheckBox, "cell 2 0"); + //---- hiddenTabsNavigationLabel ---- hiddenTabsNavigationLabel.setText("Hidden tabs navigation:"); tabbedPaneControlPanel.add(hiddenTabsNavigationLabel, "cell 0 1"); @@ -727,6 +759,8 @@ public class FlatContainerTest private JCheckBox tabScrollCheckBox; private JSpinner tabCountSpinner; private JCheckBox customTabsCheckBox; + private JCheckBox htmlTabsCheckBox; + private JCheckBox multiLineTabsCheckBox; private JComboBox hiddenTabsNavigationField; private JCheckBox tabBackForegroundCheckBox; private JComboBox tabPlacementField; 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 050f03e4..2fb4ea68 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 @@ -176,6 +176,26 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 2 0" } ) + add( new FormComponent( "javax.swing.JCheckBox" ) { + name: "htmlTabsCheckBox" + "text": "HTML" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "htmlTabsChanged", false ) ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 0" + } ) + add( new FormComponent( "javax.swing.JCheckBox" ) { + name: "multiLineTabsCheckBox" + "text": "multi-line" + auxiliary() { + "JavaCodeGenerator.variableLocal": false + } + addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "htmlTabsChanged", false ) ) + }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { + "value": "cell 2 0" + } ) add( new FormComponent( "javax.swing.JLabel" ) { name: "hiddenTabsNavigationLabel" "text": "Hidden tabs navigation:"