mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-08 23:08:42 +03:00
use MigLayout for FlatComponentsTest because this scales gaps in Java 8
This commit is contained in:
@@ -20,6 +20,14 @@ plugins {
|
|||||||
`java-library`
|
`java-library`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
testCompile( "com.miglayout:miglayout-swing:5.2" )
|
||||||
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
|||||||
@@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
package com.formdev.flatlaf;
|
package com.formdev.flatlaf;
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
import net.miginfocom.swing.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Karl Tauber
|
* @author Karl Tauber
|
||||||
@@ -58,75 +58,64 @@ public class FlatComponentsTest
|
|||||||
FlatComponentsTest.TestDefaultButton button5 = new FlatComponentsTest.TestDefaultButton();
|
FlatComponentsTest.TestDefaultButton button5 = new FlatComponentsTest.TestDefaultButton();
|
||||||
|
|
||||||
//======== this ========
|
//======== this ========
|
||||||
setLayout(new GridBagLayout());
|
setLayout(new MigLayout(
|
||||||
((GridBagLayout)getLayout()).columnWidths = new int[] {0, 0, 0, 0, 0, 0, 0};
|
"insets 0,hidemode 3,gap 5 5",
|
||||||
((GridBagLayout)getLayout()).rowHeights = new int[] {0, 0, 0};
|
// columns
|
||||||
((GridBagLayout)getLayout()).columnWeights = new double[] {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4};
|
"[]" +
|
||||||
((GridBagLayout)getLayout()).rowWeights = new double[] {0.0, 0.0, 1.0E-4};
|
"[]" +
|
||||||
|
"[]" +
|
||||||
|
"[]" +
|
||||||
|
"[]" +
|
||||||
|
"[]",
|
||||||
|
// rows
|
||||||
|
"[]" +
|
||||||
|
"[]"));
|
||||||
|
|
||||||
//---- labelLabel ----
|
//---- labelLabel ----
|
||||||
labelLabel.setText("JLabel:");
|
labelLabel.setText("JLabel:");
|
||||||
add(labelLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
|
add(labelLabel, "cell 0 0");
|
||||||
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
|
|
||||||
new Insets(0, 0, 5, 5), 0, 0));
|
|
||||||
|
|
||||||
//---- label1 ----
|
//---- label1 ----
|
||||||
label1.setText("enabled");
|
label1.setText("enabled");
|
||||||
label1.setDisplayedMnemonic('E');
|
label1.setDisplayedMnemonic('E');
|
||||||
add(label1, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,
|
add(label1, "cell 1 0");
|
||||||
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
|
|
||||||
new Insets(0, 0, 5, 5), 0, 0));
|
|
||||||
|
|
||||||
//---- label2 ----
|
//---- label2 ----
|
||||||
label2.setText("disabled");
|
label2.setText("disabled");
|
||||||
label2.setDisplayedMnemonic('D');
|
label2.setDisplayedMnemonic('D');
|
||||||
label2.setEnabled(false);
|
label2.setEnabled(false);
|
||||||
add(label2, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0,
|
add(label2, "cell 2 0");
|
||||||
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
|
|
||||||
new Insets(0, 0, 5, 5), 0, 0));
|
|
||||||
|
|
||||||
//---- buttonLabel ----
|
//---- buttonLabel ----
|
||||||
buttonLabel.setText("JButton:");
|
buttonLabel.setText("JButton:");
|
||||||
add(buttonLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0,
|
add(buttonLabel, "cell 0 1");
|
||||||
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
|
|
||||||
new Insets(0, 0, 0, 5), 0, 0));
|
|
||||||
|
|
||||||
//---- button1 ----
|
//---- button1 ----
|
||||||
button1.setText("enabled");
|
button1.setText("enabled");
|
||||||
button1.setDisplayedMnemonicIndex(0);
|
button1.setDisplayedMnemonicIndex(0);
|
||||||
add(button1, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0,
|
add(button1, "cell 1 1");
|
||||||
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
|
|
||||||
new Insets(0, 0, 0, 5), 0, 0));
|
|
||||||
|
|
||||||
//---- button2 ----
|
//---- button2 ----
|
||||||
button2.setText("disabled");
|
button2.setText("disabled");
|
||||||
button2.setDisplayedMnemonicIndex(0);
|
button2.setDisplayedMnemonicIndex(0);
|
||||||
button2.setEnabled(false);
|
button2.setEnabled(false);
|
||||||
add(button2, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0,
|
add(button2, "cell 2 1");
|
||||||
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
|
|
||||||
new Insets(0, 0, 0, 5), 0, 0));
|
|
||||||
|
|
||||||
//---- button3 ----
|
//---- button3 ----
|
||||||
button3.setText("selected");
|
button3.setText("selected");
|
||||||
button3.setSelected(true);
|
button3.setSelected(true);
|
||||||
add(button3, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0,
|
add(button3, "cell 3 1");
|
||||||
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
|
|
||||||
new Insets(0, 0, 0, 5), 0, 0));
|
|
||||||
|
|
||||||
//---- button4 ----
|
//---- button4 ----
|
||||||
button4.setText("selected disabled");
|
button4.setText("selected disabled");
|
||||||
button4.setSelected(true);
|
button4.setSelected(true);
|
||||||
button4.setEnabled(false);
|
button4.setEnabled(false);
|
||||||
add(button4, new GridBagConstraints(4, 1, 1, 1, 0.0, 0.0,
|
add(button4, "cell 4 1");
|
||||||
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
|
|
||||||
new Insets(0, 0, 0, 5), 0, 0));
|
|
||||||
|
|
||||||
//---- button5 ----
|
//---- button5 ----
|
||||||
button5.setText("default");
|
button5.setText("default");
|
||||||
button5.setDisplayedMnemonicIndex(0);
|
button5.setDisplayedMnemonicIndex(0);
|
||||||
add(button5, new GridBagConstraints(5, 1, 1, 1, 0.0, 0.0,
|
add(button5, "cell 5 1");
|
||||||
GridBagConstraints.CENTER, GridBagConstraints.BOTH,
|
|
||||||
new Insets(0, 0, 0, 0), 0, 0));
|
|
||||||
// JFormDesigner - End of component initialization //GEN-END:initComponents
|
// JFormDesigner - End of component initialization //GEN-END:initComponents
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,81 +6,75 @@ new FormModel {
|
|||||||
auxiliary() {
|
auxiliary() {
|
||||||
"JavaCodeGenerator.defaultVariableLocal": true
|
"JavaCodeGenerator.defaultVariableLocal": true
|
||||||
}
|
}
|
||||||
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class java.awt.GridBagLayout ) {
|
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
|
||||||
"$columnSpecs": "0, 0, 0, 0, 0, 0"
|
"$layoutConstraints": "insets 0,hidemode 3,gap 5 5"
|
||||||
"$rowSpecs": "0, 0"
|
"$columnConstraints": "[][][][][][]"
|
||||||
"$hGap": 5
|
"$rowConstraints": "[][]"
|
||||||
"$vGap": 5
|
|
||||||
"$alignLeft": true
|
|
||||||
"$alignTop": true
|
|
||||||
} ) {
|
} ) {
|
||||||
name: "this"
|
name: "this"
|
||||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
name: "labelLabel"
|
name: "labelLabel"
|
||||||
"text": "JLabel:"
|
"text": "JLabel:"
|
||||||
}, new FormLayoutConstraints( class com.jformdesigner.runtime.GridBagConstraintsEx ) )
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
|
"value": "cell 0 0"
|
||||||
|
} )
|
||||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
name: "label1"
|
name: "label1"
|
||||||
"text": "enabled"
|
"text": "enabled"
|
||||||
"displayedMnemonic": 69
|
"displayedMnemonic": 69
|
||||||
}, new FormLayoutConstraints( class com.jformdesigner.runtime.GridBagConstraintsEx ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"gridx": 1
|
"value": "cell 1 0"
|
||||||
} )
|
} )
|
||||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
name: "label2"
|
name: "label2"
|
||||||
"text": "disabled"
|
"text": "disabled"
|
||||||
"displayedMnemonic": 68
|
"displayedMnemonic": 68
|
||||||
"enabled": false
|
"enabled": false
|
||||||
}, new FormLayoutConstraints( class com.jformdesigner.runtime.GridBagConstraintsEx ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"gridx": 2
|
"value": "cell 2 0"
|
||||||
} )
|
} )
|
||||||
add( new FormComponent( "javax.swing.JLabel" ) {
|
add( new FormComponent( "javax.swing.JLabel" ) {
|
||||||
name: "buttonLabel"
|
name: "buttonLabel"
|
||||||
"text": "JButton:"
|
"text": "JButton:"
|
||||||
}, new FormLayoutConstraints( class com.jformdesigner.runtime.GridBagConstraintsEx ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"gridy": 1
|
"value": "cell 0 1"
|
||||||
} )
|
} )
|
||||||
add( new FormComponent( "javax.swing.JButton" ) {
|
add( new FormComponent( "javax.swing.JButton" ) {
|
||||||
name: "button1"
|
name: "button1"
|
||||||
"text": "enabled"
|
"text": "enabled"
|
||||||
"displayedMnemonicIndex": 0
|
"displayedMnemonicIndex": 0
|
||||||
}, new FormLayoutConstraints( class com.jformdesigner.runtime.GridBagConstraintsEx ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"gridx": 1
|
"value": "cell 1 1"
|
||||||
"gridy": 1
|
|
||||||
} )
|
} )
|
||||||
add( new FormComponent( "javax.swing.JButton" ) {
|
add( new FormComponent( "javax.swing.JButton" ) {
|
||||||
name: "button2"
|
name: "button2"
|
||||||
"text": "disabled"
|
"text": "disabled"
|
||||||
"displayedMnemonicIndex": 0
|
"displayedMnemonicIndex": 0
|
||||||
"enabled": false
|
"enabled": false
|
||||||
}, new FormLayoutConstraints( class com.jformdesigner.runtime.GridBagConstraintsEx ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"gridx": 2
|
"value": "cell 2 1"
|
||||||
"gridy": 1
|
|
||||||
} )
|
} )
|
||||||
add( new FormComponent( "javax.swing.JButton" ) {
|
add( new FormComponent( "javax.swing.JButton" ) {
|
||||||
name: "button3"
|
name: "button3"
|
||||||
"text": "selected"
|
"text": "selected"
|
||||||
"selected": true
|
"selected": true
|
||||||
}, new FormLayoutConstraints( class com.jformdesigner.runtime.GridBagConstraintsEx ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"gridx": 3
|
"value": "cell 3 1"
|
||||||
"gridy": 1
|
|
||||||
} )
|
} )
|
||||||
add( new FormComponent( "javax.swing.JButton" ) {
|
add( new FormComponent( "javax.swing.JButton" ) {
|
||||||
name: "button4"
|
name: "button4"
|
||||||
"text": "selected disabled"
|
"text": "selected disabled"
|
||||||
"selected": true
|
"selected": true
|
||||||
"enabled": false
|
"enabled": false
|
||||||
}, new FormLayoutConstraints( class com.jformdesigner.runtime.GridBagConstraintsEx ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"gridx": 4
|
"value": "cell 4 1"
|
||||||
"gridy": 1
|
|
||||||
} )
|
} )
|
||||||
add( new FormComponent( "com.formdev.flatlaf.FlatComponentsTest$TestDefaultButton" ) {
|
add( new FormComponent( "com.formdev.flatlaf.FlatComponentsTest$TestDefaultButton" ) {
|
||||||
name: "button5"
|
name: "button5"
|
||||||
"text": "default"
|
"text": "default"
|
||||||
"displayedMnemonicIndex": 0
|
"displayedMnemonicIndex": 0
|
||||||
}, new FormLayoutConstraints( class com.jformdesigner.runtime.GridBagConstraintsEx ) {
|
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
|
||||||
"gridx": 5
|
"value": "cell 5 1"
|
||||||
"gridy": 1
|
|
||||||
} )
|
} )
|
||||||
}, 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