Demo: moved split panes from "SplitPane & Tabs" tab to "More Components" tab (to make room for more tabbed pane features)

This commit is contained in:
Karl Tauber
2020-11-01 16:45:05 +01:00
parent 6167c5f855
commit c6d561f2df
6 changed files with 191 additions and 188 deletions

View File

@@ -680,11 +680,12 @@ class DemoFrame
//======== tabbedPane ========
{
tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
tabbedPane.addChangeListener(e -> selectedTabChanged());
tabbedPane.addTab("Basic Components", basicComponentsPanel);
tabbedPane.addTab("More Components", moreComponentsPanel);
tabbedPane.addTab("Data Components", dataComponentsPanel);
tabbedPane.addTab("SplitPane & Tabs", tabsPanel);
tabbedPane.addTab("Tabs", tabsPanel);
tabbedPane.addTab("Option Pane", optionPanePanel);
tabbedPane.addTab("Extras", extrasPanel1);
}

View File

@@ -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"
@@ -64,6 +64,7 @@ new FormModel {
name: "contentPanel"
add( new FormContainer( "javax.swing.JTabbedPane", new FormLayoutManager( class javax.swing.JTabbedPane ) ) {
name: "tabbedPane"
"tabLayoutPolicy": 1
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
@@ -86,7 +87,7 @@ new FormModel {
add( new FormComponent( "com.formdev.flatlaf.demo.TabsPanel" ) {
name: "tabsPanel"
}, new FormLayoutConstraints( null ) {
"title": "SplitPane & Tabs"
"title": "Tabs"
} )
add( new FormComponent( "com.formdev.flatlaf.demo.OptionPanePanel" ) {
name: "optionPanePanel"

View File

@@ -101,6 +101,18 @@ class MoreComponentsPanel
JButton button8 = new JButton();
JToggleButton toggleButton6 = new JToggleButton();
JButton button1 = new JButton();
JLabel splitPaneLabel = new JLabel();
JSplitPane splitPane3 = new JSplitPane();
JSplitPane splitPane1 = new JSplitPane();
JPanel panel10 = new JPanel();
JLabel label1 = new JLabel();
JPanel panel11 = new JPanel();
JLabel label2 = new JLabel();
JSplitPane splitPane2 = new JSplitPane();
JPanel panel12 = new JPanel();
JLabel label5 = new JLabel();
JPanel panel13 = new JPanel();
JLabel label6 = new JLabel();
//======== this ========
setLayout(new MigLayout(
@@ -122,7 +134,8 @@ class MoreComponentsPanel
"[]" +
"[]" +
"[]" +
"[]"));
"[]" +
"[100,top]"));
//---- scrollPaneLabel ----
scrollPaneLabel.setText("JScrollPane:");
@@ -386,6 +399,81 @@ class MoreComponentsPanel
toolBar1.add(button1);
}
add(toolBar1, "cell 1 10 3 1,growx");
//---- splitPaneLabel ----
splitPaneLabel.setText("JSplitPane:");
add(splitPaneLabel, "cell 0 11");
//======== splitPane3 ========
{
splitPane3.setResizeWeight(0.5);
//======== splitPane1 ========
{
splitPane1.setResizeWeight(0.5);
//======== panel10 ========
{
panel10.setBackground(new Color(217, 163, 67));
panel10.setLayout(new BorderLayout());
//---- label1 ----
label1.setText("LEFT");
label1.setHorizontalAlignment(SwingConstants.CENTER);
label1.setForeground(Color.white);
panel10.add(label1, BorderLayout.CENTER);
}
splitPane1.setLeftComponent(panel10);
//======== panel11 ========
{
panel11.setBackground(new Color(98, 181, 67));
panel11.setLayout(new BorderLayout());
//---- label2 ----
label2.setText("RIGHT");
label2.setHorizontalAlignment(SwingConstants.CENTER);
label2.setForeground(Color.white);
panel11.add(label2, BorderLayout.CENTER);
}
splitPane1.setRightComponent(panel11);
}
splitPane3.setLeftComponent(splitPane1);
//======== splitPane2 ========
{
splitPane2.setOrientation(JSplitPane.VERTICAL_SPLIT);
splitPane2.setResizeWeight(0.5);
//======== panel12 ========
{
panel12.setBackground(new Color(242, 101, 34));
panel12.setLayout(new BorderLayout());
//---- label5 ----
label5.setText("TOP");
label5.setHorizontalAlignment(SwingConstants.CENTER);
label5.setForeground(Color.white);
panel12.add(label5, BorderLayout.CENTER);
}
splitPane2.setTopComponent(panel12);
//======== panel13 ========
{
panel13.setBackground(new Color(64, 182, 224));
panel13.setLayout(new BorderLayout());
//---- label6 ----
label6.setText("BOTTOM");
label6.setHorizontalAlignment(SwingConstants.CENTER);
label6.setForeground(Color.white);
panel13.add(label6, BorderLayout.CENTER);
}
splitPane2.setBottomComponent(panel13);
}
splitPane3.setRightComponent(splitPane2);
}
add(splitPane3, "cell 1 11 4 1,grow");
// JFormDesigner - End of component initialization //GEN-END:initComponents
if( FlatLafDemo.screenshotsMode ) {

View File

@@ -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"
@@ -9,7 +9,7 @@ new FormModel {
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "insets dialog,hidemode 3"
"$columnConstraints": "[][][][][]"
"$rowConstraints": "[][][][][][][][][][][]"
"$rowConstraints": "[][][][][][][][][][][][100,top]"
} ) {
name: "this"
add( new FormComponent( "javax.swing.JLabel" ) {
@@ -358,9 +358,90 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 10 3 1,growx"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "splitPaneLabel"
"text": "JSplitPane:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 11"
} )
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
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.BorderLayout ) ) {
name: "panel10"
"background": new java.awt.Color( 217, 163, 67, 255 )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label1"
"text": "LEFT"
"horizontalAlignment": 0
"foreground": sfield java.awt.Color white
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "Center"
} )
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "left"
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.BorderLayout ) ) {
name: "panel11"
"background": new java.awt.Color( 98, 181, 67, 255 )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label2"
"text": "RIGHT"
"horizontalAlignment": 0
"foreground": sfield java.awt.Color white
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "Center"
} )
}, 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
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.BorderLayout ) ) {
name: "panel12"
"background": new java.awt.Color( 242, 101, 34, 255 )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label5"
"text": "TOP"
"horizontalAlignment": 0
"foreground": sfield java.awt.Color white
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "Center"
} )
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "left"
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.BorderLayout ) ) {
name: "panel13"
"background": new java.awt.Color( 64, 182, 224, 255 )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label6"
"text": "BOTTOM"
"horizontalAlignment": 0
"foreground": sfield java.awt.Color white
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "Center"
} )
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "right"
} )
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "right"
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 11 4 1,grow"
} )
}, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 0 )
"size": new java.awt.Dimension( 700, 420 )
"size": new java.awt.Dimension( 700, 550 )
} )
}
}

View File

@@ -141,18 +141,6 @@ class TabsPanel
private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
JPanel panel9 = new JPanel();
JLabel splitPaneLabel = new JLabel();
JSplitPane splitPane3 = new JSplitPane();
JSplitPane splitPane1 = new JSplitPane();
JPanel panel10 = new JPanel();
JLabel label1 = new JLabel();
JPanel panel11 = new JPanel();
JLabel label2 = new JLabel();
JSplitPane splitPane2 = new JSplitPane();
JPanel panel12 = new JPanel();
JLabel label3 = new JLabel();
JPanel panel13 = new JPanel();
JLabel label4 = new JLabel();
JLabel tabbedPaneLabel = new JLabel();
tabbedPane1 = new JTabbedPane();
tabbedPane3 = new JTabbedPane();
@@ -178,105 +166,30 @@ class TabsPanel
{
panel9.setLayout(new FormLayout(
"70dlu:grow, $ugap, 70dlu:grow",
"default, $lgap, fill:70dlu, $pgap, pref, $lgap, 2*(fill:80dlu:grow, $ugap), pref"));
//---- splitPaneLabel ----
splitPaneLabel.setText("JSplitPane:");
panel9.add(splitPaneLabel, cc.xy(1, 1));
//======== splitPane3 ========
{
splitPane3.setResizeWeight(0.5);
//======== splitPane1 ========
{
splitPane1.setResizeWeight(0.5);
//======== panel10 ========
{
panel10.setBackground(new Color(217, 163, 67));
panel10.setLayout(new BorderLayout());
//---- label1 ----
label1.setText("LEFT");
label1.setHorizontalAlignment(SwingConstants.CENTER);
label1.setForeground(Color.white);
panel10.add(label1, BorderLayout.CENTER);
}
splitPane1.setLeftComponent(panel10);
//======== panel11 ========
{
panel11.setBackground(new Color(98, 181, 67));
panel11.setLayout(new BorderLayout());
//---- label2 ----
label2.setText("RIGHT");
label2.setHorizontalAlignment(SwingConstants.CENTER);
label2.setForeground(Color.white);
panel11.add(label2, BorderLayout.CENTER);
}
splitPane1.setRightComponent(panel11);
}
splitPane3.setLeftComponent(splitPane1);
//======== splitPane2 ========
{
splitPane2.setOrientation(JSplitPane.VERTICAL_SPLIT);
splitPane2.setResizeWeight(0.5);
//======== panel12 ========
{
panel12.setBackground(new Color(242, 101, 34));
panel12.setLayout(new BorderLayout());
//---- label3 ----
label3.setText("TOP");
label3.setHorizontalAlignment(SwingConstants.CENTER);
label3.setForeground(Color.white);
panel12.add(label3, BorderLayout.CENTER);
}
splitPane2.setTopComponent(panel12);
//======== panel13 ========
{
panel13.setBackground(new Color(64, 182, 224));
panel13.setLayout(new BorderLayout());
//---- label4 ----
label4.setText("BOTTOM");
label4.setHorizontalAlignment(SwingConstants.CENTER);
label4.setForeground(Color.white);
panel13.add(label4, BorderLayout.CENTER);
}
splitPane2.setBottomComponent(panel13);
}
splitPane3.setRightComponent(splitPane2);
}
panel9.add(splitPane3, cc.xywh(1, 3, 3, 1));
"pref, $lgap, 2*(fill:80dlu:grow, $ugap), pref"));
//---- tabbedPaneLabel ----
tabbedPaneLabel.setText("JTabbedPane:");
panel9.add(tabbedPaneLabel, cc.xy(1, 5));
panel9.add(tabbedPane1, cc.xy(1, 7));
panel9.add(tabbedPaneLabel, cc.xy(1, 1));
panel9.add(tabbedPane1, cc.xy(1, 3));
//======== tabbedPane3 ========
{
tabbedPane3.setTabPlacement(SwingConstants.LEFT);
}
panel9.add(tabbedPane3, cc.xy(3, 7));
panel9.add(tabbedPane3, cc.xy(3, 3));
//======== tabbedPane2 ========
{
tabbedPane2.setTabPlacement(SwingConstants.BOTTOM);
}
panel9.add(tabbedPane2, cc.xy(1, 9));
panel9.add(tabbedPane2, cc.xy(1, 5));
//======== tabbedPane4 ========
{
tabbedPane4.setTabPlacement(SwingConstants.RIGHT);
}
panel9.add(tabbedPane4, cc.xy(3, 9));
panel9.add(tabbedPane4, cc.xy(3, 5));
//======== panel14 ========
{
@@ -318,7 +231,7 @@ class TabsPanel
hasFullBorderCheckBox.addActionListener(e -> hasFullBorderChanged());
panel14.add(hasFullBorderCheckBox, "cell 4 0,alignx left,growx 0");
}
panel9.add(panel14, cc.xywh(1, 11, 3, 1));
panel9.add(panel14, cc.xywh(1, 7, 3, 1));
}
add(panel9, "cell 0 0");
// JFormDesigner - End of component initialization //GEN-END:initComponents

View File

@@ -14,95 +14,14 @@ new FormModel {
name: "this"
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class com.jgoodies.forms.layout.FormLayout ) {
"$columnSpecs": "70dlu:grow, unrelgap, 70dlu:grow"
"$rowSpecs": "default, linegap, fill:70dlu, pargap, pref, linegap, fill:80dlu:grow, unrelgap, fill:80dlu:grow, unrelgap, pref"
"$rowSpecs": "pref, linegap, fill:80dlu:grow, unrelgap, fill:80dlu:grow, unrelgap, pref"
} ) {
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
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.BorderLayout ) ) {
name: "panel10"
"background": new java.awt.Color( 217, 163, 67, 255 )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label1"
"text": "LEFT"
"horizontalAlignment": 0
"foreground": sfield java.awt.Color white
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "Center"
} )
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "left"
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.BorderLayout ) ) {
name: "panel11"
"background": new java.awt.Color( 98, 181, 67, 255 )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label2"
"text": "RIGHT"
"horizontalAlignment": 0
"foreground": sfield java.awt.Color white
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "Center"
} )
}, 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
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.BorderLayout ) ) {
name: "panel12"
"background": new java.awt.Color( 242, 101, 34, 255 )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label3"
"text": "TOP"
"horizontalAlignment": 0
"foreground": sfield java.awt.Color white
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "Center"
} )
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "left"
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.BorderLayout ) ) {
name: "panel13"
"background": new java.awt.Color( 64, 182, 224, 255 )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "label4"
"text": "BOTTOM"
"horizontalAlignment": 0
"foreground": sfield java.awt.Color white
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "Center"
} )
}, 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" ) {
name: "tabbedPaneLabel"
"text": "JTabbedPane:"
}, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) {
"gridX": 1
"gridY": 5
} )
add( new FormContainer( "javax.swing.JTabbedPane", new FormLayoutManager( class javax.swing.JTabbedPane ) ) {
name: "tabbedPane1"
@@ -111,7 +30,7 @@ new FormModel {
}
}, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) {
"gridX": 1
"gridY": 7
"gridY": 3
} )
add( new FormContainer( "javax.swing.JTabbedPane", new FormLayoutManager( class javax.swing.JTabbedPane ) ) {
name: "tabbedPane3"
@@ -121,7 +40,7 @@ new FormModel {
}
}, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) {
"gridX": 3
"gridY": 7
"gridY": 3
} )
add( new FormContainer( "javax.swing.JTabbedPane", new FormLayoutManager( class javax.swing.JTabbedPane ) ) {
name: "tabbedPane2"
@@ -130,7 +49,7 @@ new FormModel {
"JavaCodeGenerator.variableLocal": false
}
}, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) {
"gridY": 9
"gridY": 5
} )
add( new FormContainer( "javax.swing.JTabbedPane", new FormLayoutManager( class javax.swing.JTabbedPane ) ) {
name: "tabbedPane4"
@@ -140,7 +59,7 @@ new FormModel {
}
}, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) {
"gridX": 3
"gridY": 9
"gridY": 5
} )
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "insets 0,hidemode 3"
@@ -201,7 +120,7 @@ new FormModel {
"value": "cell 4 0,alignx left,growx 0"
} )
}, new FormLayoutConstraints( class com.jgoodies.forms.layout.CellConstraints ) {
"gridY": 11
"gridY": 7
"gridWidth": 3
} )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {