mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 06:27:13 -06:00
Demo: improved layout of tabbed pane options
This commit is contained in:
@@ -94,26 +94,25 @@ public class FlatContainerTest
|
||||
JLabel label7 = new JLabel();
|
||||
JPanel panel8 = new JPanel();
|
||||
JLabel label8 = new JLabel();
|
||||
JPanel panel14 = new JPanel();
|
||||
moreTabsCheckBox = new JCheckBox();
|
||||
tabScrollCheckBox = new JCheckBox();
|
||||
hasFullBorderCheckBox = new JCheckBox();
|
||||
moreTabsCheckBox = new JCheckBox();
|
||||
CellConstraints cc = new CellConstraints();
|
||||
|
||||
//======== this ========
|
||||
setLayout(new MigLayout(
|
||||
"insets 0,hidemode 3",
|
||||
// columns
|
||||
"[grow,fill]" +
|
||||
"[fill]",
|
||||
"[grow,fill]",
|
||||
// rows
|
||||
"[grow,fill]" +
|
||||
"[]"));
|
||||
"[grow,fill]"));
|
||||
|
||||
//======== panel9 ========
|
||||
{
|
||||
panel9.setLayout(new FormLayout(
|
||||
"70dlu:grow, $lcgap, 70dlu:grow",
|
||||
"default, $lgap, fill:70dlu, $lgap, pref, 2*($lgap, fill:70dlu:grow), 2*($lgap, pref)"));
|
||||
"default, $lgap, fill:70dlu, $lgap, pref, 2*($lgap, fill:70dlu:grow), $lgap, pref"));
|
||||
|
||||
//---- splitPaneLabel ----
|
||||
splitPaneLabel.setText("JSplitPane:");
|
||||
@@ -280,23 +279,36 @@ public class FlatContainerTest
|
||||
}
|
||||
panel9.add(tabbedPane4, cc.xy(3, 9));
|
||||
|
||||
//---- tabScrollCheckBox ----
|
||||
tabScrollCheckBox.setText("tabLayoutPolicy = SCROLL");
|
||||
tabScrollCheckBox.setMnemonic('S');
|
||||
tabScrollCheckBox.addActionListener(e -> tabScrollChanged());
|
||||
panel9.add(tabScrollCheckBox, cc.xy(1, 11, CellConstraints.LEFT, CellConstraints.DEFAULT));
|
||||
//======== panel14 ========
|
||||
{
|
||||
panel14.setLayout(new MigLayout(
|
||||
"insets 0,hidemode 3",
|
||||
// columns
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]",
|
||||
// rows
|
||||
"[center]"));
|
||||
|
||||
//---- hasFullBorderCheckBox ----
|
||||
hasFullBorderCheckBox.setText("JTabbedPane.hasFullBorder");
|
||||
hasFullBorderCheckBox.setMnemonic('F');
|
||||
hasFullBorderCheckBox.addActionListener(e -> hasFullBorderChanged());
|
||||
panel9.add(hasFullBorderCheckBox, cc.xy(3, 11, CellConstraints.LEFT, CellConstraints.DEFAULT));
|
||||
//---- moreTabsCheckBox ----
|
||||
moreTabsCheckBox.setText("more tabs");
|
||||
moreTabsCheckBox.setMnemonic('M');
|
||||
moreTabsCheckBox.addActionListener(e -> moreTabsChanged());
|
||||
panel14.add(moreTabsCheckBox, "cell 0 0");
|
||||
|
||||
//---- moreTabsCheckBox ----
|
||||
moreTabsCheckBox.setText("more tabs");
|
||||
moreTabsCheckBox.setMnemonic('M');
|
||||
moreTabsCheckBox.addActionListener(e -> moreTabsChanged());
|
||||
panel9.add(moreTabsCheckBox, cc.xy(1, 13, CellConstraints.LEFT, CellConstraints.DEFAULT));
|
||||
//---- tabScrollCheckBox ----
|
||||
tabScrollCheckBox.setText("tabLayoutPolicy = SCROLL");
|
||||
tabScrollCheckBox.setMnemonic('S');
|
||||
tabScrollCheckBox.addActionListener(e -> tabScrollChanged());
|
||||
panel14.add(tabScrollCheckBox, "cell 1 0,alignx left,growx 0");
|
||||
|
||||
//---- hasFullBorderCheckBox ----
|
||||
hasFullBorderCheckBox.setText("JTabbedPane.hasFullBorder");
|
||||
hasFullBorderCheckBox.setMnemonic('F');
|
||||
hasFullBorderCheckBox.addActionListener(e -> hasFullBorderChanged());
|
||||
panel14.add(hasFullBorderCheckBox, "cell 2 0,alignx left,growx 0");
|
||||
}
|
||||
panel9.add(panel14, cc.xywh(1, 11, 3, 1));
|
||||
}
|
||||
add(panel9, "cell 0 0");
|
||||
// JFormDesigner - End of component initialization //GEN-END:initComponents
|
||||
@@ -307,8 +319,8 @@ public class FlatContainerTest
|
||||
private JTabbedPane tabbedPane3;
|
||||
private JTabbedPane tabbedPane2;
|
||||
private JTabbedPane tabbedPane4;
|
||||
private JCheckBox moreTabsCheckBox;
|
||||
private JCheckBox tabScrollCheckBox;
|
||||
private JCheckBox hasFullBorderCheckBox;
|
||||
private JCheckBox moreTabsCheckBox;
|
||||
// JFormDesigner - End of variables declaration //GEN-END:variables
|
||||
}
|
||||
|
||||
@@ -8,13 +8,13 @@ new FormModel {
|
||||
}
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "insets 0,hidemode 3"
|
||||
"$columnConstraints": "[grow,fill][fill]"
|
||||
"$rowConstraints": "[grow,fill][]"
|
||||
"$columnConstraints": "[grow,fill]"
|
||||
"$rowConstraints": "[grow,fill]"
|
||||
} ) {
|
||||
name: "this"
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class com.jgoodies.forms.layout.FormLayout ) {
|
||||
"$columnSpecs": "70dlu:grow, labelcompgap, 70dlu:grow"
|
||||
"$rowSpecs": "default, linegap, fill:70dlu, linegap, pref, linegap, fill:70dlu:grow, linegap, fill:70dlu:grow, linegap, pref, linegap, pref"
|
||||
"$rowSpecs": "default, linegap, fill:70dlu, linegap, pref, linegap, fill:70dlu:grow, linegap, fill:70dlu:grow, linegap, pref"
|
||||
} ) {
|
||||
name: "panel9"
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
@@ -197,51 +197,55 @@ new FormModel {
|
||||
"gridX": 3
|
||||
"gridY": 9
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "tabScrollCheckBox"
|
||||
"text": "tabLayoutPolicy = SCROLL"
|
||||
"mnemonic": 83
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabScrollChanged", false ) )
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "insets 0,hidemode 3"
|
||||
"$columnConstraints": "[][][]"
|
||||
"$rowConstraints": "[center]"
|
||||
} ) {
|
||||
name: "panel14"
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "moreTabsCheckBox"
|
||||
"text": "more tabs"
|
||||
"mnemonic": 77
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "moreTabsChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "tabScrollCheckBox"
|
||||
"text": "tabLayoutPolicy = SCROLL"
|
||||
"mnemonic": 83
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabScrollChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 0,alignx left,growx 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "hasFullBorderCheckBox"
|
||||
"text": "JTabbedPane.hasFullBorder"
|
||||
"mnemonic": 70
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "hasFullBorderChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 0,alignx left,growx 0"
|
||||
} )
|
||||
}, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) {
|
||||
"gridX": 1
|
||||
"gridY": 11
|
||||
"hAlign": sfield com.jgoodies.forms.layout.CellConstraints LEFT
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "hasFullBorderCheckBox"
|
||||
"text": "JTabbedPane.hasFullBorder"
|
||||
"mnemonic": 70
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "hasFullBorderChanged", false ) )
|
||||
}, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) {
|
||||
"gridX": 3
|
||||
"gridY": 11
|
||||
"hAlign": sfield com.jgoodies.forms.layout.CellConstraints LEFT
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "moreTabsCheckBox"
|
||||
"text": "more tabs"
|
||||
"mnemonic": 77
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "moreTabsChanged", false ) )
|
||||
}, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) {
|
||||
"gridX": 1
|
||||
"gridY": 13
|
||||
"hAlign": sfield com.jgoodies.forms.layout.CellConstraints LEFT
|
||||
"gridWidth": 3
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 0"
|
||||
} )
|
||||
}, new FormLayoutConstraints( null ) {
|
||||
"location": new java.awt.Point( 0, 0 )
|
||||
"size": new java.awt.Dimension( 405, 515 )
|
||||
"size": new java.awt.Dimension( 500, 515 )
|
||||
} )
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,9 +92,10 @@ class TabsPanel
|
||||
JLabel label7 = new JLabel();
|
||||
JPanel panel8 = new JPanel();
|
||||
JLabel label8 = new JLabel();
|
||||
JPanel panel14 = new JPanel();
|
||||
moreTabsCheckBox = new JCheckBox();
|
||||
tabScrollCheckBox = new JCheckBox();
|
||||
hasFullBorderCheckBox = new JCheckBox();
|
||||
moreTabsCheckBox = new JCheckBox();
|
||||
CellConstraints cc = new CellConstraints();
|
||||
|
||||
//======== this ========
|
||||
@@ -109,7 +110,7 @@ class TabsPanel
|
||||
{
|
||||
panel9.setLayout(new FormLayout(
|
||||
"70dlu:grow, $lcgap, 70dlu:grow",
|
||||
"default, $lgap, fill:70dlu, $lgap, pref, 2*($lgap, fill:70dlu:grow), 2*($lgap, pref)"));
|
||||
"default, $lgap, fill:70dlu, $lgap, pref, 2*($lgap, fill:70dlu:grow), $lgap, pref"));
|
||||
|
||||
//---- splitPaneLabel ----
|
||||
splitPaneLabel.setText("JSplitPane:");
|
||||
@@ -276,23 +277,36 @@ class TabsPanel
|
||||
}
|
||||
panel9.add(tabbedPane4, cc.xy(3, 9));
|
||||
|
||||
//---- tabScrollCheckBox ----
|
||||
tabScrollCheckBox.setText("tabLayoutPolicy = SCROLL");
|
||||
tabScrollCheckBox.setMnemonic('S');
|
||||
tabScrollCheckBox.addActionListener(e -> tabScrollChanged());
|
||||
panel9.add(tabScrollCheckBox, cc.xy(1, 11, CellConstraints.LEFT, CellConstraints.DEFAULT));
|
||||
//======== panel14 ========
|
||||
{
|
||||
panel14.setLayout(new MigLayout(
|
||||
"insets 0,hidemode 3",
|
||||
// columns
|
||||
"[]" +
|
||||
"[]" +
|
||||
"[]",
|
||||
// rows
|
||||
"[center]"));
|
||||
|
||||
//---- hasFullBorderCheckBox ----
|
||||
hasFullBorderCheckBox.setText("JTabbedPane.hasFullBorder");
|
||||
hasFullBorderCheckBox.setMnemonic('F');
|
||||
hasFullBorderCheckBox.addActionListener(e -> hasFullBorderChanged());
|
||||
panel9.add(hasFullBorderCheckBox, cc.xy(3, 11, CellConstraints.LEFT, CellConstraints.DEFAULT));
|
||||
//---- moreTabsCheckBox ----
|
||||
moreTabsCheckBox.setText("more tabs");
|
||||
moreTabsCheckBox.setMnemonic('M');
|
||||
moreTabsCheckBox.addActionListener(e -> moreTabsChanged());
|
||||
panel14.add(moreTabsCheckBox, "cell 0 0");
|
||||
|
||||
//---- moreTabsCheckBox ----
|
||||
moreTabsCheckBox.setText("more tabs");
|
||||
moreTabsCheckBox.setMnemonic('M');
|
||||
moreTabsCheckBox.addActionListener(e -> moreTabsChanged());
|
||||
panel9.add(moreTabsCheckBox, cc.xy(1, 13, CellConstraints.LEFT, CellConstraints.DEFAULT));
|
||||
//---- tabScrollCheckBox ----
|
||||
tabScrollCheckBox.setText("tabLayoutPolicy = SCROLL");
|
||||
tabScrollCheckBox.setMnemonic('S');
|
||||
tabScrollCheckBox.addActionListener(e -> tabScrollChanged());
|
||||
panel14.add(tabScrollCheckBox, "cell 1 0,alignx left,growx 0");
|
||||
|
||||
//---- hasFullBorderCheckBox ----
|
||||
hasFullBorderCheckBox.setText("JTabbedPane.hasFullBorder");
|
||||
hasFullBorderCheckBox.setMnemonic('F');
|
||||
hasFullBorderCheckBox.addActionListener(e -> hasFullBorderChanged());
|
||||
panel14.add(hasFullBorderCheckBox, "cell 2 0,alignx left,growx 0");
|
||||
}
|
||||
panel9.add(panel14, cc.xywh(1, 11, 3, 1));
|
||||
}
|
||||
add(panel9, "cell 0 0");
|
||||
// JFormDesigner - End of component initialization //GEN-END:initComponents
|
||||
@@ -303,8 +317,8 @@ class TabsPanel
|
||||
private JTabbedPane tabbedPane3;
|
||||
private JTabbedPane tabbedPane2;
|
||||
private JTabbedPane tabbedPane4;
|
||||
private JCheckBox moreTabsCheckBox;
|
||||
private JCheckBox tabScrollCheckBox;
|
||||
private JCheckBox hasFullBorderCheckBox;
|
||||
private JCheckBox moreTabsCheckBox;
|
||||
// JFormDesigner - End of variables declaration //GEN-END:variables
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ new FormModel {
|
||||
name: "this"
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class com.jgoodies.forms.layout.FormLayout ) {
|
||||
"$columnSpecs": "70dlu:grow, labelcompgap, 70dlu:grow"
|
||||
"$rowSpecs": "default, linegap, fill:70dlu, linegap, pref, linegap, fill:70dlu:grow, linegap, fill:70dlu:grow, linegap, pref, linegap, pref"
|
||||
"$rowSpecs": "default, linegap, fill:70dlu, linegap, pref, linegap, fill:70dlu:grow, linegap, fill:70dlu:grow, linegap, pref"
|
||||
} ) {
|
||||
name: "panel9"
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
@@ -197,51 +197,55 @@ new FormModel {
|
||||
"gridX": 3
|
||||
"gridY": 9
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "tabScrollCheckBox"
|
||||
"text": "tabLayoutPolicy = SCROLL"
|
||||
"mnemonic": 83
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabScrollChanged", false ) )
|
||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "insets 0,hidemode 3"
|
||||
"$columnConstraints": "[][][]"
|
||||
"$rowConstraints": "[center]"
|
||||
} ) {
|
||||
name: "panel14"
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "moreTabsCheckBox"
|
||||
"text": "more tabs"
|
||||
"mnemonic": 77
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "moreTabsChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "tabScrollCheckBox"
|
||||
"text": "tabLayoutPolicy = SCROLL"
|
||||
"mnemonic": 83
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabScrollChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 0,alignx left,growx 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "hasFullBorderCheckBox"
|
||||
"text": "JTabbedPane.hasFullBorder"
|
||||
"mnemonic": 70
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "hasFullBorderChanged", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 2 0,alignx left,growx 0"
|
||||
} )
|
||||
}, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) {
|
||||
"gridX": 1
|
||||
"gridY": 11
|
||||
"hAlign": sfield com.jgoodies.forms.layout.CellConstraints LEFT
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "hasFullBorderCheckBox"
|
||||
"text": "JTabbedPane.hasFullBorder"
|
||||
"mnemonic": 70
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "hasFullBorderChanged", false ) )
|
||||
}, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) {
|
||||
"gridX": 3
|
||||
"gridY": 11
|
||||
"hAlign": sfield com.jgoodies.forms.layout.CellConstraints LEFT
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "moreTabsCheckBox"
|
||||
"text": "more tabs"
|
||||
"mnemonic": 77
|
||||
auxiliary() {
|
||||
"JavaCodeGenerator.variableLocal": false
|
||||
}
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "moreTabsChanged", false ) )
|
||||
}, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) {
|
||||
"gridX": 1
|
||||
"gridY": 13
|
||||
"hAlign": sfield com.jgoodies.forms.layout.CellConstraints LEFT
|
||||
"gridWidth": 3
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 0"
|
||||
} )
|
||||
}, new FormLayoutConstraints( null ) {
|
||||
"location": new java.awt.Point( 0, 0 )
|
||||
"size": new java.awt.Dimension( 400, 585 )
|
||||
"size": new java.awt.Dimension( 500, 515 )
|
||||
} )
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user