Demo: added SplitPane

This commit is contained in:
Karl Tauber
2019-09-08 19:00:27 +02:00
parent 650ce12c22
commit e6de6b565b
4 changed files with 132 additions and 21 deletions

View File

@@ -237,7 +237,7 @@ class DemoFrame
tabbedPane.addTab("Basic Components", basicComponentsPanel); tabbedPane.addTab("Basic Components", basicComponentsPanel);
tabbedPane.addTab("More Components", moreComponentsPanel); tabbedPane.addTab("More Components", moreComponentsPanel);
tabbedPane.addTab("Data Components", dataComponentsPanel); tabbedPane.addTab("Data Components", dataComponentsPanel);
tabbedPane.addTab("Tabs", tabsPanel); tabbedPane.addTab("SplitPane & Tabs", tabsPanel);
tabbedPane.addTab("Option Pane", optionPanePanel); tabbedPane.addTab("Option Pane", optionPanePanel);
} }
contentPanel.add(tabbedPane, "cell 0 0"); contentPanel.add(tabbedPane, "cell 0 0");

View File

@@ -79,7 +79,7 @@ new FormModel {
add( new FormComponent( "com.formdev.flatlaf.demo.TabsPanel" ) { add( new FormComponent( "com.formdev.flatlaf.demo.TabsPanel" ) {
name: "tabsPanel" name: "tabsPanel"
}, new FormLayoutConstraints( null ) { }, new FormLayoutConstraints( null ) {
"title": "Tabs" "title": "SplitPane & Tabs"
} ) } )
add( new FormComponent( "com.formdev.flatlaf.demo.OptionPanePanel" ) { add( new FormComponent( "com.formdev.flatlaf.demo.OptionPanePanel" ) {
name: "optionPanePanel" name: "optionPanePanel"

View File

@@ -63,6 +63,14 @@ class TabsPanel
private void initComponents() { private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
JPanel panel9 = new JPanel(); JPanel panel9 = new JPanel();
JLabel splitPaneLabel = new JLabel();
JSplitPane splitPane3 = new JSplitPane();
JSplitPane splitPane1 = new JSplitPane();
JPanel panel10 = new JPanel();
JPanel panel11 = new JPanel();
JSplitPane splitPane2 = new JSplitPane();
JPanel panel12 = new JPanel();
JPanel panel13 = new JPanel();
JLabel tabbedPaneLabel = new JLabel(); JLabel tabbedPaneLabel = new JLabel();
tabbedPane1 = new JTabbedPane(); tabbedPane1 = new JTabbedPane();
JPanel panel1 = new JPanel(); JPanel panel1 = new JPanel();
@@ -101,11 +109,64 @@ class TabsPanel
{ {
panel9.setLayout(new FormLayout( panel9.setLayout(new FormLayout(
"70dlu:grow, $lcgap, 70dlu:grow", "70dlu:grow, $lcgap, 70dlu:grow",
"pref, 2*($lgap, fill:70dlu:grow), 2*($lgap, pref)")); "default, $lgap, fill:70dlu, $lgap, pref, 2*($lgap, fill:70dlu:grow), 2*($lgap, pref)"));
//---- splitPaneLabel ----
splitPaneLabel.setText("JSplitPane:");
panel9.add(splitPaneLabel, cc.xy(1, 1));
//======== splitPane3 ========
{
splitPane3.setResizeWeight(0.5);
//======== splitPane1 ========
{
splitPane1.setResizeWeight(0.5);
splitPane1.setOneTouchExpandable(true);
//======== panel10 ========
{
panel10.setBackground(Color.orange);
panel10.setLayout(new FlowLayout());
}
splitPane1.setLeftComponent(panel10);
//======== panel11 ========
{
panel11.setBackground(Color.magenta);
panel11.setLayout(new FlowLayout());
}
splitPane1.setRightComponent(panel11);
}
splitPane3.setLeftComponent(splitPane1);
//======== splitPane2 ========
{
splitPane2.setOrientation(JSplitPane.VERTICAL_SPLIT);
splitPane2.setResizeWeight(0.5);
splitPane2.setOneTouchExpandable(true);
//======== panel12 ========
{
panel12.setBackground(Color.orange);
panel12.setLayout(new FlowLayout());
}
splitPane2.setTopComponent(panel12);
//======== panel13 ========
{
panel13.setBackground(Color.magenta);
panel13.setLayout(new FlowLayout());
}
splitPane2.setBottomComponent(panel13);
}
splitPane3.setRightComponent(splitPane2);
}
panel9.add(splitPane3, cc.xywh(1, 3, 3, 1));
//---- tabbedPaneLabel ---- //---- tabbedPaneLabel ----
tabbedPaneLabel.setText("JTabbedPane:"); tabbedPaneLabel.setText("JTabbedPane:");
panel9.add(tabbedPaneLabel, cc.xy(1, 1)); panel9.add(tabbedPaneLabel, cc.xy(1, 5));
//======== tabbedPane1 ======== //======== tabbedPane1 ========
{ {
@@ -131,7 +192,7 @@ class TabsPanel
label2.setText("text"); label2.setText("text");
tabbedPane1.addTab("Tab 3", label2); tabbedPane1.addTab("Tab 3", label2);
} }
panel9.add(tabbedPane1, cc.xy(1, 3)); panel9.add(tabbedPane1, cc.xy(1, 7));
//======== tabbedPane3 ======== //======== tabbedPane3 ========
{ {
@@ -158,7 +219,7 @@ class TabsPanel
label6.setText("text"); label6.setText("text");
tabbedPane3.addTab("Tab 3", label6); tabbedPane3.addTab("Tab 3", label6);
} }
panel9.add(tabbedPane3, cc.xy(3, 3)); panel9.add(tabbedPane3, cc.xy(3, 7));
//======== tabbedPane2 ======== //======== tabbedPane2 ========
{ {
@@ -186,7 +247,7 @@ class TabsPanel
label4.setText("text"); label4.setText("text");
tabbedPane2.addTab("Tab 3", label4); tabbedPane2.addTab("Tab 3", label4);
} }
panel9.add(tabbedPane2, cc.xy(1, 5)); panel9.add(tabbedPane2, cc.xy(1, 9));
//======== tabbedPane4 ======== //======== tabbedPane4 ========
{ {
@@ -213,25 +274,25 @@ class TabsPanel
label8.setText("text"); label8.setText("text");
tabbedPane4.addTab("Tab 3", label8); tabbedPane4.addTab("Tab 3", label8);
} }
panel9.add(tabbedPane4, cc.xy(3, 5)); panel9.add(tabbedPane4, cc.xy(3, 9));
//---- tabScrollCheckBox ---- //---- tabScrollCheckBox ----
tabScrollCheckBox.setText("tabLayoutPolicy = SCROLL"); tabScrollCheckBox.setText("tabLayoutPolicy = SCROLL");
tabScrollCheckBox.setMnemonic('S'); tabScrollCheckBox.setMnemonic('S');
tabScrollCheckBox.addActionListener(e -> tabScrollChanged()); tabScrollCheckBox.addActionListener(e -> tabScrollChanged());
panel9.add(tabScrollCheckBox, cc.xy(1, 7, CellConstraints.LEFT, CellConstraints.DEFAULT)); panel9.add(tabScrollCheckBox, cc.xy(1, 11, CellConstraints.LEFT, CellConstraints.DEFAULT));
//---- hasFullBorderCheckBox ---- //---- hasFullBorderCheckBox ----
hasFullBorderCheckBox.setText("JTabbedPane.hasFullBorder"); hasFullBorderCheckBox.setText("JTabbedPane.hasFullBorder");
hasFullBorderCheckBox.setMnemonic('F'); hasFullBorderCheckBox.setMnemonic('F');
hasFullBorderCheckBox.addActionListener(e -> hasFullBorderChanged()); hasFullBorderCheckBox.addActionListener(e -> hasFullBorderChanged());
panel9.add(hasFullBorderCheckBox, cc.xy(3, 7, CellConstraints.LEFT, CellConstraints.DEFAULT)); panel9.add(hasFullBorderCheckBox, cc.xy(3, 11, CellConstraints.LEFT, CellConstraints.DEFAULT));
//---- moreTabsCheckBox ---- //---- moreTabsCheckBox ----
moreTabsCheckBox.setText("more tabs"); moreTabsCheckBox.setText("more tabs");
moreTabsCheckBox.setMnemonic('M'); moreTabsCheckBox.setMnemonic('M');
moreTabsCheckBox.addActionListener(e -> moreTabsChanged()); moreTabsCheckBox.addActionListener(e -> moreTabsChanged());
panel9.add(moreTabsCheckBox, cc.xy(1, 9, CellConstraints.LEFT, CellConstraints.DEFAULT)); panel9.add(moreTabsCheckBox, cc.xy(1, 13, CellConstraints.LEFT, CellConstraints.DEFAULT));
} }
add(panel9, "cell 0 0"); add(panel9, "cell 0 0");
// JFormDesigner - End of component initialization //GEN-END:initComponents // JFormDesigner - End of component initialization //GEN-END:initComponents

View File

@@ -14,15 +14,65 @@ new FormModel {
name: "this" name: "this"
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class com.jgoodies.forms.layout.FormLayout ) { add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class com.jgoodies.forms.layout.FormLayout ) {
"$columnSpecs": "70dlu:grow, labelcompgap, 70dlu:grow" "$columnSpecs": "70dlu:grow, labelcompgap, 70dlu:grow"
"$rowSpecs": "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, linegap, pref"
} ) { } ) {
name: "panel9" name: "panel9"
add( new FormComponent( "javax.swing.JLabel" ) {
name: "splitPaneLabel"
"text": "JSplitPane:"
}, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) )
add( new FormContainer( "javax.swing.JSplitPane", new FormLayoutManager( class javax.swing.JSplitPane ) ) {
name: "splitPane3"
"resizeWeight": 0.5
add( new FormContainer( "javax.swing.JSplitPane", new FormLayoutManager( class javax.swing.JSplitPane ) ) {
name: "splitPane1"
"resizeWeight": 0.5
"oneTouchExpandable": true
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.FlowLayout ) ) {
name: "panel10"
"background": sfield java.awt.Color orange
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "left"
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.FlowLayout ) ) {
name: "panel11"
"background": sfield java.awt.Color magenta
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "right"
} )
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "left"
} )
add( new FormContainer( "javax.swing.JSplitPane", new FormLayoutManager( class javax.swing.JSplitPane ) ) {
name: "splitPane2"
"orientation": 0
"resizeWeight": 0.5
"oneTouchExpandable": true
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.FlowLayout ) ) {
name: "panel12"
"background": sfield java.awt.Color orange
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "left"
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.FlowLayout ) ) {
name: "panel13"
"background": sfield java.awt.Color magenta
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "right"
} )
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "right"
} )
}, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) {
"gridY": 3
"gridWidth": 3
} )
add( new FormComponent( "javax.swing.JLabel" ) { add( new FormComponent( "javax.swing.JLabel" ) {
name: "tabbedPaneLabel" name: "tabbedPaneLabel"
"text": "JTabbedPane:" "text": "JTabbedPane:"
}, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) { }, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) {
"gridX": 1 "gridX": 1
"gridY": 1 "gridY": 5
} ) } )
add( new FormContainer( "javax.swing.JTabbedPane", new FormLayoutManager( class javax.swing.JTabbedPane ) ) { add( new FormContainer( "javax.swing.JTabbedPane", new FormLayoutManager( class javax.swing.JTabbedPane ) ) {
name: "tabbedPane1" name: "tabbedPane1"
@@ -52,7 +102,7 @@ new FormModel {
} ) } )
}, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) { }, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) {
"gridX": 1 "gridX": 1
"gridY": 3 "gridY": 7
} ) } )
add( new FormContainer( "javax.swing.JTabbedPane", new FormLayoutManager( class javax.swing.JTabbedPane ) ) { add( new FormContainer( "javax.swing.JTabbedPane", new FormLayoutManager( class javax.swing.JTabbedPane ) ) {
name: "tabbedPane3" name: "tabbedPane3"
@@ -83,7 +133,7 @@ new FormModel {
} ) } )
}, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) { }, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) {
"gridX": 3 "gridX": 3
"gridY": 3 "gridY": 7
} ) } )
add( new FormContainer( "javax.swing.JTabbedPane", new FormLayoutManager( class javax.swing.JTabbedPane ) ) { add( new FormContainer( "javax.swing.JTabbedPane", new FormLayoutManager( class javax.swing.JTabbedPane ) ) {
name: "tabbedPane2" name: "tabbedPane2"
@@ -114,7 +164,7 @@ new FormModel {
"title": "Tab 3" "title": "Tab 3"
} ) } )
}, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) { }, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) {
"gridY": 5 "gridY": 9
} ) } )
add( new FormContainer( "javax.swing.JTabbedPane", new FormLayoutManager( class javax.swing.JTabbedPane ) ) { add( new FormContainer( "javax.swing.JTabbedPane", new FormLayoutManager( class javax.swing.JTabbedPane ) ) {
name: "tabbedPane4" name: "tabbedPane4"
@@ -145,7 +195,7 @@ new FormModel {
} ) } )
}, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) { }, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) {
"gridX": 3 "gridX": 3
"gridY": 5 "gridY": 9
} ) } )
add( new FormComponent( "javax.swing.JCheckBox" ) { add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "tabScrollCheckBox" name: "tabScrollCheckBox"
@@ -157,7 +207,7 @@ new FormModel {
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabScrollChanged", false ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "tabScrollChanged", false ) )
}, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) { }, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) {
"gridX": 1 "gridX": 1
"gridY": 7 "gridY": 11
"hAlign": sfield com.jgoodies.forms.layout.CellConstraints LEFT "hAlign": sfield com.jgoodies.forms.layout.CellConstraints LEFT
} ) } )
add( new FormComponent( "javax.swing.JCheckBox" ) { add( new FormComponent( "javax.swing.JCheckBox" ) {
@@ -170,7 +220,7 @@ new FormModel {
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "hasFullBorderChanged", false ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "hasFullBorderChanged", false ) )
}, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) { }, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) {
"gridX": 3 "gridX": 3
"gridY": 7 "gridY": 11
"hAlign": sfield com.jgoodies.forms.layout.CellConstraints LEFT "hAlign": sfield com.jgoodies.forms.layout.CellConstraints LEFT
} ) } )
add( new FormComponent( "javax.swing.JCheckBox" ) { add( new FormComponent( "javax.swing.JCheckBox" ) {
@@ -183,7 +233,7 @@ new FormModel {
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "moreTabsChanged", false ) ) addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "moreTabsChanged", false ) )
}, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) { }, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) {
"gridX": 1 "gridX": 1
"gridY": 9 "gridY": 13
"hAlign": sfield com.jgoodies.forms.layout.CellConstraints LEFT "hAlign": sfield com.jgoodies.forms.layout.CellConstraints LEFT
} ) } )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
@@ -191,7 +241,7 @@ new FormModel {
} ) } )
}, new FormLayoutConstraints( null ) { }, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 0 ) "location": new java.awt.Point( 0, 0 )
"size": new java.awt.Dimension( 400, 400 ) "size": new java.awt.Dimension( 400, 585 )
} ) } )
} }
} }