Demo: wrap OptionPanePanel in JPanel to avoid that JFormDesigner tries to convert it to a container when opening DemoFrame.jfd

This commit is contained in:
Karl Tauber
2020-05-02 00:33:47 +02:00
parent a48713b7ca
commit 584286b794
2 changed files with 426 additions and 414 deletions

View File

@@ -27,7 +27,7 @@ import net.miginfocom.swing.*;
* @author Karl Tauber * @author Karl Tauber
*/ */
class OptionPanePanel class OptionPanePanel
extends JScrollPane extends JPanel
{ {
OptionPanePanel() { OptionPanePanel() {
initComponents(); initComponents();
@@ -48,6 +48,7 @@ class OptionPanePanel
private void initComponents() { private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
JScrollPane scrollPane1 = new JScrollPane();
ScrollablePanel panel9 = new ScrollablePanel(); ScrollablePanel panel9 = new ScrollablePanel();
JLabel plainLabel = new JLabel(); JLabel plainLabel = new JLabel();
JPanel panel1 = new JPanel(); JPanel panel1 = new JPanel();
@@ -83,7 +84,11 @@ class OptionPanePanel
OptionPanePanel.ShowDialogLinkLabel customShowDialogLabel = new OptionPanePanel.ShowDialogLinkLabel(); OptionPanePanel.ShowDialogLinkLabel customShowDialogLabel = new OptionPanePanel.ShowDialogLinkLabel();
//======== this ======== //======== this ========
setBorder(BorderFactory.createEmptyBorder()); setLayout(new BorderLayout());
//======== scrollPane1 ========
{
scrollPane1.setBorder(BorderFactory.createEmptyBorder());
//======== panel9 ======== //======== panel9 ========
{ {
@@ -276,7 +281,9 @@ class OptionPanePanel
customShowDialogLabel.setTitleLabel(customLabel); customShowDialogLabel.setTitleLabel(customLabel);
panel9.add(customShowDialogLabel, "cell 2 7"); panel9.add(customShowDialogLabel, "cell 2 7");
} }
setViewportView(panel9); scrollPane1.setViewportView(panel9);
}
add(scrollPane1, BorderLayout.CENTER);
// JFormDesigner - End of component initialization //GEN-END:initComponents // JFormDesigner - End of component initialization //GEN-END:initComponents
} }

View File

@@ -6,8 +6,10 @@ new FormModel {
auxiliary() { auxiliary() {
"JavaCodeGenerator.defaultVariableLocal": true "JavaCodeGenerator.defaultVariableLocal": true
} }
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) { add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.BorderLayout ) ) {
name: "this" name: "this"
add( new FormContainer( "javax.swing.JScrollPane", new FormLayoutManager( class javax.swing.JScrollPane ) ) {
name: "scrollPane1"
"border": new javax.swing.border.EmptyBorder( 0, 0, 0, 0 ) "border": new javax.swing.border.EmptyBorder( 0, 0, 0, 0 )
add( new FormContainer( "com.formdev.flatlaf.demo.ScrollablePanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) { add( new FormContainer( "com.formdev.flatlaf.demo.ScrollablePanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "flowy,hidemode 3" "$layoutConstraints": "flowy,hidemode 3"
@@ -241,6 +243,9 @@ new FormModel {
"value": "cell 2 7" "value": "cell 2 7"
} ) } )
} ) } )
}, new FormLayoutConstraints( class java.lang.String ) {
"value": "Center"
} )
}, 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( 840, 900 ) "size": new java.awt.Dimension( 840, 900 )