mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-12 06:57:13 -06:00
InternalFrame: limit internal frame bounds to parent bounds on resize; honor maximum size of internal frame (issue #362)
This commit is contained in:
@@ -89,6 +89,15 @@ public class FlatInternalFrameTest
|
||||
};
|
||||
internalFrame.setContentPane( panel );
|
||||
|
||||
if( minSizeCheckBox.isSelected() ) {
|
||||
internalFrame.setMinimumSize( new Dimension( 300, 150 ) );
|
||||
panel.add( new JLabel( "min 300,150" ) );
|
||||
}
|
||||
if( maxSizeCheckBox.isSelected() ) {
|
||||
internalFrame.setMaximumSize( new Dimension( 400, 200 ) );
|
||||
panel.add( new JLabel( "max 400,200" ) );
|
||||
}
|
||||
|
||||
if( !palette.getComponentOrientation().isLeftToRight() )
|
||||
internalFrame.setComponentOrientation( ComponentOrientation.RIGHT_TO_LEFT );
|
||||
|
||||
@@ -123,6 +132,8 @@ public class FlatInternalFrameTest
|
||||
maximizableCheckBox = new JCheckBox();
|
||||
iconCheckBox = new FlatTriStateCheckBox();
|
||||
menuBarCheckBox = new JCheckBox();
|
||||
minSizeCheckBox = new JCheckBox();
|
||||
maxSizeCheckBox = new JCheckBox();
|
||||
titleLabel = new JLabel();
|
||||
titleField = new JTextField();
|
||||
createFrameButton = new JButton();
|
||||
@@ -158,6 +169,8 @@ public class FlatInternalFrameTest
|
||||
"[fill]0" +
|
||||
"[]0" +
|
||||
"[]0" +
|
||||
"[]0" +
|
||||
"[]0" +
|
||||
"[]unrel" +
|
||||
"[]unrel"));
|
||||
|
||||
@@ -189,18 +202,26 @@ public class FlatInternalFrameTest
|
||||
menuBarCheckBox.setText("Menu Bar");
|
||||
paletteContentPane.add(menuBarCheckBox, "cell 1 2");
|
||||
|
||||
//---- minSizeCheckBox ----
|
||||
minSizeCheckBox.setText("Minimum size 300,150");
|
||||
paletteContentPane.add(minSizeCheckBox, "cell 0 3 2 1,alignx left,growx 0");
|
||||
|
||||
//---- maxSizeCheckBox ----
|
||||
maxSizeCheckBox.setText("Maximum size 400,200");
|
||||
paletteContentPane.add(maxSizeCheckBox, "cell 0 4 2 1,alignx left,growx 0");
|
||||
|
||||
//---- titleLabel ----
|
||||
titleLabel.setText("Frame title:");
|
||||
paletteContentPane.add(titleLabel, "cell 0 3");
|
||||
paletteContentPane.add(titleField, "cell 1 3");
|
||||
paletteContentPane.add(titleLabel, "cell 0 5");
|
||||
paletteContentPane.add(titleField, "cell 1 5");
|
||||
|
||||
//---- createFrameButton ----
|
||||
createFrameButton.setText("Create Frame");
|
||||
createFrameButton.addActionListener(e -> createInternalFrame());
|
||||
paletteContentPane.add(createFrameButton, "cell 1 4,alignx right,growx 0");
|
||||
paletteContentPane.add(createFrameButton, "cell 1 6,alignx right,growx 0");
|
||||
}
|
||||
desktopPane.add(palette, JLayeredPane.PALETTE_LAYER);
|
||||
palette.setBounds(15, 25, 275, 185);
|
||||
palette.setBounds(15, 25, 275, 275);
|
||||
}
|
||||
add(desktopPane, "cell 0 0,width 600,height 600");
|
||||
|
||||
@@ -234,6 +255,8 @@ public class FlatInternalFrameTest
|
||||
private JCheckBox maximizableCheckBox;
|
||||
private FlatTriStateCheckBox iconCheckBox;
|
||||
private JCheckBox menuBarCheckBox;
|
||||
private JCheckBox minSizeCheckBox;
|
||||
private JCheckBox maxSizeCheckBox;
|
||||
private JLabel titleLabel;
|
||||
private JTextField titleField;
|
||||
private JButton createFrameButton;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
JFDML JFormDesigner: "7.0.3.1.342" Java: "16" encoding: "UTF-8"
|
||||
JFDML JFormDesigner: "7.0.4.0.360" Java: "16" encoding: "UTF-8"
|
||||
|
||||
new FormModel {
|
||||
contentType: "form/swing"
|
||||
@@ -14,7 +14,7 @@ new FormModel {
|
||||
add( new FormContainer( "javax.swing.JInternalFrame", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||
"$layoutConstraints": "hidemode 3"
|
||||
"$columnConstraints": "[fill][fill]"
|
||||
"$rowConstraints": "[fill]0[]0[]0[]unrel[]unrel"
|
||||
"$rowConstraints": "[fill]0[]0[]0[]0[]0[]unrel[]unrel"
|
||||
} ) {
|
||||
name: "palette"
|
||||
"visible": true
|
||||
@@ -62,29 +62,41 @@ new FormModel {
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 2"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "minSizeCheckBox"
|
||||
"text": "Minimum size 300,150"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 3 2 1,alignx left,growx 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||
name: "maxSizeCheckBox"
|
||||
"text": "Maximum size 400,200"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 4 2 1,alignx left,growx 0"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||
name: "titleLabel"
|
||||
"text": "Frame title:"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 0 3"
|
||||
"value": "cell 0 5"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JTextField" ) {
|
||||
name: "titleField"
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 3"
|
||||
"value": "cell 1 5"
|
||||
} )
|
||||
add( new FormComponent( "javax.swing.JButton" ) {
|
||||
name: "createFrameButton"
|
||||
"text": "Create Frame"
|
||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "createInternalFrame", false ) )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
"value": "cell 1 4,alignx right,growx 0"
|
||||
"value": "cell 1 6,alignx right,growx 0"
|
||||
} )
|
||||
}, new FormLayoutConstraints( null ) {
|
||||
"x": 15
|
||||
"y": 25
|
||||
"width": 275
|
||||
"height": 185
|
||||
"height": 275
|
||||
"layer": 100
|
||||
} )
|
||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||
|
||||
Reference in New Issue
Block a user