mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-14 07:47:12 -06:00
FlatContainerTest: test HTML tab titles
This commit is contained in:
@@ -232,6 +232,26 @@ public class FlatContainerTest
|
|||||||
return tab;
|
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
|
||||||
|
? "<html><b>Bold</b> Tab<br>Second <i>Line</i> "
|
||||||
|
: (html ? "<html><b>Bold</b> 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() {
|
private void tabPlacementChanged() {
|
||||||
int tabPlacement = -1;
|
int tabPlacement = -1;
|
||||||
switch( (String) tabPlacementField.getSelectedItem() ) {
|
switch( (String) tabPlacementField.getSelectedItem() ) {
|
||||||
@@ -394,6 +414,8 @@ public class FlatContainerTest
|
|||||||
JLabel tabCountLabel = new JLabel();
|
JLabel tabCountLabel = new JLabel();
|
||||||
tabCountSpinner = new JSpinner();
|
tabCountSpinner = new JSpinner();
|
||||||
customTabsCheckBox = new JCheckBox();
|
customTabsCheckBox = new JCheckBox();
|
||||||
|
htmlTabsCheckBox = new JCheckBox();
|
||||||
|
multiLineTabsCheckBox = new JCheckBox();
|
||||||
JLabel hiddenTabsNavigationLabel = new JLabel();
|
JLabel hiddenTabsNavigationLabel = new JLabel();
|
||||||
hiddenTabsNavigationField = new JComboBox<>();
|
hiddenTabsNavigationField = new JComboBox<>();
|
||||||
tabBackForegroundCheckBox = new JCheckBox();
|
tabBackForegroundCheckBox = new JCheckBox();
|
||||||
@@ -560,6 +582,16 @@ public class FlatContainerTest
|
|||||||
customTabsCheckBox.addActionListener(e -> customTabsChanged());
|
customTabsCheckBox.addActionListener(e -> customTabsChanged());
|
||||||
tabbedPaneControlPanel.add(customTabsCheckBox, "cell 2 0");
|
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 ----
|
||||||
hiddenTabsNavigationLabel.setText("Hidden tabs navigation:");
|
hiddenTabsNavigationLabel.setText("Hidden tabs navigation:");
|
||||||
tabbedPaneControlPanel.add(hiddenTabsNavigationLabel, "cell 0 1");
|
tabbedPaneControlPanel.add(hiddenTabsNavigationLabel, "cell 0 1");
|
||||||
@@ -727,6 +759,8 @@ public class FlatContainerTest
|
|||||||
private JCheckBox tabScrollCheckBox;
|
private JCheckBox tabScrollCheckBox;
|
||||||
private JSpinner tabCountSpinner;
|
private JSpinner tabCountSpinner;
|
||||||
private JCheckBox customTabsCheckBox;
|
private JCheckBox customTabsCheckBox;
|
||||||
|
private JCheckBox htmlTabsCheckBox;
|
||||||
|
private JCheckBox multiLineTabsCheckBox;
|
||||||
private JComboBox<String> hiddenTabsNavigationField;
|
private JComboBox<String> hiddenTabsNavigationField;
|
||||||
private JCheckBox tabBackForegroundCheckBox;
|
private JCheckBox tabBackForegroundCheckBox;
|
||||||
private JComboBox<String> tabPlacementField;
|
private JComboBox<String> tabPlacementField;
|
||||||
|
|||||||
@@ -176,6 +176,26 @@ new FormModel {
|
|||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 2 0"
|
"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" ) {
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
name: "hiddenTabsNavigationLabel"
|
name: "hiddenTabsNavigationLabel"
|
||||||
"text": "Hidden tabs navigation:"
|
"text": "Hidden tabs navigation:"
|
||||||
|
|||||||
Reference in New Issue
Block a user