mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-13 15:27:16 -06:00
Window decorations: FlatWindowDecorationsTest: added "undecorated" checkbox
This commit is contained in:
@@ -81,6 +81,11 @@ public class FlatWindowDecorationsTest
|
|||||||
iconTestAllRadioButton.setEnabled( windowHasIcons );
|
iconTestAllRadioButton.setEnabled( windowHasIcons );
|
||||||
iconTestRandomRadioButton.setEnabled( windowHasIcons );
|
iconTestRandomRadioButton.setEnabled( windowHasIcons );
|
||||||
|
|
||||||
|
if( window instanceof Frame )
|
||||||
|
undecoratedCheckBox.setSelected( ((Frame)window).isUndecorated() );
|
||||||
|
else if( window instanceof Dialog )
|
||||||
|
undecoratedCheckBox.setSelected( ((Dialog)window).isUndecorated() );
|
||||||
|
|
||||||
JRootPane rootPane = getWindowRootPane();
|
JRootPane rootPane = getWindowRootPane();
|
||||||
if( rootPane != null ) {
|
if( rootPane != null ) {
|
||||||
int style = rootPane.getWindowDecorationStyle();
|
int style = rootPane.getWindowDecorationStyle();
|
||||||
@@ -120,6 +125,21 @@ public class FlatWindowDecorationsTest
|
|||||||
((Dialog)window).setResizable( resizableCheckBox.isSelected() );
|
((Dialog)window).setResizable( resizableCheckBox.isSelected() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void undecoratedChanged() {
|
||||||
|
Window window = SwingUtilities.windowForComponent( this );
|
||||||
|
if( window == null )
|
||||||
|
return;
|
||||||
|
|
||||||
|
window.dispose();
|
||||||
|
|
||||||
|
if( window instanceof Frame )
|
||||||
|
((Frame)window).setUndecorated( undecoratedCheckBox.isSelected() );
|
||||||
|
else if( window instanceof Dialog )
|
||||||
|
((Dialog)window).setUndecorated( undecoratedCheckBox.isSelected() );
|
||||||
|
|
||||||
|
window.setVisible( true );
|
||||||
|
}
|
||||||
|
|
||||||
private void maximizedBoundsChanged() {
|
private void maximizedBoundsChanged() {
|
||||||
Window window = SwingUtilities.windowForComponent( this );
|
Window window = SwingUtilities.windowForComponent( this );
|
||||||
if( window instanceof Frame ) {
|
if( window instanceof Frame ) {
|
||||||
@@ -201,6 +221,7 @@ public class FlatWindowDecorationsTest
|
|||||||
menuBarEmbeddedCheckBox = new JCheckBox();
|
menuBarEmbeddedCheckBox = new JCheckBox();
|
||||||
resizableCheckBox = new JCheckBox();
|
resizableCheckBox = new JCheckBox();
|
||||||
maximizedBoundsCheckBox = new JCheckBox();
|
maximizedBoundsCheckBox = new JCheckBox();
|
||||||
|
undecoratedCheckBox = new JCheckBox();
|
||||||
JLabel label1 = new JLabel();
|
JLabel label1 = new JLabel();
|
||||||
JLabel label2 = new JLabel();
|
JLabel label2 = new JLabel();
|
||||||
JPanel panel1 = new JPanel();
|
JPanel panel1 = new JPanel();
|
||||||
@@ -254,6 +275,7 @@ public class FlatWindowDecorationsTest
|
|||||||
// rows
|
// rows
|
||||||
"para[]0" +
|
"para[]0" +
|
||||||
"[]0" +
|
"[]0" +
|
||||||
|
"[]0" +
|
||||||
"[]" +
|
"[]" +
|
||||||
"[]" +
|
"[]" +
|
||||||
"[top]" +
|
"[top]" +
|
||||||
@@ -282,13 +304,18 @@ public class FlatWindowDecorationsTest
|
|||||||
maximizedBoundsCheckBox.addActionListener(e -> maximizedBoundsChanged());
|
maximizedBoundsCheckBox.addActionListener(e -> maximizedBoundsChanged());
|
||||||
add(maximizedBoundsCheckBox, "cell 1 2");
|
add(maximizedBoundsCheckBox, "cell 1 2");
|
||||||
|
|
||||||
|
//---- undecoratedCheckBox ----
|
||||||
|
undecoratedCheckBox.setText("undecorated");
|
||||||
|
undecoratedCheckBox.addActionListener(e -> undecoratedChanged());
|
||||||
|
add(undecoratedCheckBox, "cell 0 3");
|
||||||
|
|
||||||
//---- label1 ----
|
//---- label1 ----
|
||||||
label1.setText("Style:");
|
label1.setText("Style:");
|
||||||
add(label1, "cell 0 3");
|
add(label1, "cell 0 4");
|
||||||
|
|
||||||
//---- label2 ----
|
//---- label2 ----
|
||||||
label2.setText("Icon:");
|
label2.setText("Icon:");
|
||||||
add(label2, "cell 1 3");
|
add(label2, "cell 1 4");
|
||||||
|
|
||||||
//======== panel1 ========
|
//======== panel1 ========
|
||||||
{
|
{
|
||||||
@@ -353,7 +380,7 @@ public class FlatWindowDecorationsTest
|
|||||||
styleFileChooserRadioButton.addActionListener(e -> decorationStyleChanged());
|
styleFileChooserRadioButton.addActionListener(e -> decorationStyleChanged());
|
||||||
panel1.add(styleFileChooserRadioButton, "cell 0 8");
|
panel1.add(styleFileChooserRadioButton, "cell 0 8");
|
||||||
}
|
}
|
||||||
add(panel1, "cell 0 4");
|
add(panel1, "cell 0 5");
|
||||||
|
|
||||||
//======== panel2 ========
|
//======== panel2 ========
|
||||||
{
|
{
|
||||||
@@ -382,12 +409,12 @@ public class FlatWindowDecorationsTest
|
|||||||
iconTestRandomRadioButton.addActionListener(e -> iconChanged());
|
iconTestRandomRadioButton.addActionListener(e -> iconChanged());
|
||||||
panel2.add(iconTestRandomRadioButton, "cell 0 2");
|
panel2.add(iconTestRandomRadioButton, "cell 0 2");
|
||||||
}
|
}
|
||||||
add(panel2, "cell 1 4");
|
add(panel2, "cell 1 5");
|
||||||
|
|
||||||
//---- openDialogButton ----
|
//---- openDialogButton ----
|
||||||
openDialogButton.setText("Open Dialog");
|
openDialogButton.setText("Open Dialog");
|
||||||
openDialogButton.addActionListener(e -> openDialog());
|
openDialogButton.addActionListener(e -> openDialog());
|
||||||
add(openDialogButton, "cell 0 5");
|
add(openDialogButton, "cell 0 6");
|
||||||
|
|
||||||
//======== menuBar ========
|
//======== menuBar ========
|
||||||
{
|
{
|
||||||
@@ -582,6 +609,7 @@ public class FlatWindowDecorationsTest
|
|||||||
private JCheckBox menuBarEmbeddedCheckBox;
|
private JCheckBox menuBarEmbeddedCheckBox;
|
||||||
private JCheckBox resizableCheckBox;
|
private JCheckBox resizableCheckBox;
|
||||||
private JCheckBox maximizedBoundsCheckBox;
|
private JCheckBox maximizedBoundsCheckBox;
|
||||||
|
private JCheckBox undecoratedCheckBox;
|
||||||
private JRadioButton styleNoneRadioButton;
|
private JRadioButton styleNoneRadioButton;
|
||||||
private JRadioButton styleFrameRadioButton;
|
private JRadioButton styleFrameRadioButton;
|
||||||
private JRadioButton stylePlainRadioButton;
|
private JRadioButton stylePlainRadioButton;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ new FormModel {
|
|||||||
add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
add( new FormContainer( "com.formdev.flatlaf.testing.FlatTestPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||||
"$layoutConstraints": "ltr,insets dialog,hidemode 3"
|
"$layoutConstraints": "ltr,insets dialog,hidemode 3"
|
||||||
"$columnConstraints": "[left]para[fill]"
|
"$columnConstraints": "[left]para[fill]"
|
||||||
"$rowConstraints": "para[]0[]0[][][top][]"
|
"$rowConstraints": "para[]0[]0[]0[][][top][]"
|
||||||
} ) {
|
} ) {
|
||||||
name: "this"
|
name: "this"
|
||||||
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||||
@@ -55,17 +55,27 @@ new FormModel {
|
|||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 1 2"
|
"value": "cell 1 2"
|
||||||
} )
|
} )
|
||||||
|
add( new FormComponent( "javax.swing.JCheckBox" ) {
|
||||||
|
name: "undecoratedCheckBox"
|
||||||
|
"text": "undecorated"
|
||||||
|
auxiliary() {
|
||||||
|
"JavaCodeGenerator.variableLocal": false
|
||||||
|
}
|
||||||
|
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "undecoratedChanged", false ) )
|
||||||
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 3"
|
||||||
|
} )
|
||||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
name: "label1"
|
name: "label1"
|
||||||
"text": "Style:"
|
"text": "Style:"
|
||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 0 3"
|
"value": "cell 0 4"
|
||||||
} )
|
} )
|
||||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
name: "label2"
|
name: "label2"
|
||||||
"text": "Icon:"
|
"text": "Icon:"
|
||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 1 3"
|
"value": "cell 1 4"
|
||||||
} )
|
} )
|
||||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||||
"$columnConstraints": "[fill]"
|
"$columnConstraints": "[fill]"
|
||||||
@@ -174,7 +184,7 @@ new FormModel {
|
|||||||
"value": "cell 0 8"
|
"value": "cell 0 8"
|
||||||
} )
|
} )
|
||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 0 4"
|
"value": "cell 0 5"
|
||||||
} )
|
} )
|
||||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||||
"$columnConstraints": "[fill]"
|
"$columnConstraints": "[fill]"
|
||||||
@@ -217,14 +227,14 @@ new FormModel {
|
|||||||
"value": "cell 0 2"
|
"value": "cell 0 2"
|
||||||
} )
|
} )
|
||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 1 4"
|
"value": "cell 1 5"
|
||||||
} )
|
} )
|
||||||
add( new FormComponent( "javax.swing.JButton" ) {
|
add( new FormComponent( "javax.swing.JButton" ) {
|
||||||
name: "openDialogButton"
|
name: "openDialogButton"
|
||||||
"text": "Open Dialog"
|
"text": "Open Dialog"
|
||||||
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "openDialog", false ) )
|
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "openDialog", false ) )
|
||||||
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"value": "cell 0 5"
|
"value": "cell 0 6"
|
||||||
} )
|
} )
|
||||||
}, new FormLayoutConstraints( null ) {
|
}, new FormLayoutConstraints( null ) {
|
||||||
"location": new java.awt.Point( 0, 0 )
|
"location": new java.awt.Point( 0, 0 )
|
||||||
|
|||||||
Reference in New Issue
Block a user