CheckBox and RadioButton implemented

Label: use same disabled text color as buttons
This commit is contained in:
Karl Tauber
2019-08-21 10:17:55 +02:00
parent e3ad1d9541
commit fb1ec54472
12 changed files with 463 additions and 6 deletions

View File

@@ -56,6 +56,16 @@ public class FlatComponentsTest
JButton button3 = new JButton();
JButton button4 = new JButton();
FlatComponentsTest.TestDefaultButton button5 = new FlatComponentsTest.TestDefaultButton();
JLabel checkBoxLabel = new JLabel();
JCheckBox checkBox1 = new JCheckBox();
JCheckBox checkBox2 = new JCheckBox();
JCheckBox checkBox3 = new JCheckBox();
JCheckBox checkBox4 = new JCheckBox();
JLabel radioButtonLabel = new JLabel();
JRadioButton radioButton1 = new JRadioButton();
JRadioButton radioButton2 = new JRadioButton();
JRadioButton radioButton3 = new JRadioButton();
JRadioButton radioButton4 = new JRadioButton();
//======== this ========
setLayout(new MigLayout(
@@ -69,6 +79,9 @@ public class FlatComponentsTest
"[]",
// rows
"[]" +
"[]" +
"[]" +
"[]" +
"[]"));
//---- labelLabel ----
@@ -116,6 +129,54 @@ public class FlatComponentsTest
button5.setText("default");
button5.setDisplayedMnemonicIndex(0);
add(button5, "cell 5 1");
//---- checkBoxLabel ----
checkBoxLabel.setText("JCheckBox");
add(checkBoxLabel, "cell 0 2");
//---- checkBox1 ----
checkBox1.setText("enabled");
add(checkBox1, "cell 1 2");
//---- checkBox2 ----
checkBox2.setText("disabled");
checkBox2.setEnabled(false);
add(checkBox2, "cell 2 2");
//---- checkBox3 ----
checkBox3.setText("selected");
checkBox3.setSelected(true);
add(checkBox3, "cell 3 2");
//---- checkBox4 ----
checkBox4.setText("selected disabled");
checkBox4.setSelected(true);
checkBox4.setEnabled(false);
add(checkBox4, "cell 4 2");
//---- radioButtonLabel ----
radioButtonLabel.setText("JRadioButton:");
add(radioButtonLabel, "cell 0 3");
//---- radioButton1 ----
radioButton1.setText("enabled");
add(radioButton1, "cell 1 3");
//---- radioButton2 ----
radioButton2.setText("disabled");
radioButton2.setEnabled(false);
add(radioButton2, "cell 2 3");
//---- radioButton3 ----
radioButton3.setText("selected");
radioButton3.setSelected(true);
add(radioButton3, "cell 3 3");
//---- radioButton4 ----
radioButton4.setText("selected disabled");
radioButton4.setSelected(true);
radioButton4.setEnabled(false);
add(radioButton4, "cell 4 3");
// JFormDesigner - End of component initialization //GEN-END:initComponents
}

View File

@@ -9,7 +9,7 @@ new FormModel {
add( new FormContainer( "javax.swing.JPanel", new FormLayoutManager( class net.miginfocom.swing.MigLayout ) {
"$layoutConstraints": "insets 0,hidemode 3,gap 5 5"
"$columnConstraints": "[][][][][][]"
"$rowConstraints": "[][]"
"$rowConstraints": "[][][][][]"
} ) {
name: "this"
add( new FormComponent( "javax.swing.JLabel" ) {
@@ -76,6 +76,74 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 5 1"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "checkBoxLabel"
"text": "JCheckBox"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 2"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "checkBox1"
"text": "enabled"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 2"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "checkBox2"
"text": "disabled"
"enabled": false
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 2"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "checkBox3"
"text": "selected"
"selected": true
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 2"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "checkBox4"
"text": "selected disabled"
"selected": true
"enabled": false
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 4 2"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "radioButtonLabel"
"text": "JRadioButton:"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 3"
} )
add( new FormComponent( "javax.swing.JRadioButton" ) {
name: "radioButton1"
"text": "enabled"
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 3"
} )
add( new FormComponent( "javax.swing.JRadioButton" ) {
name: "radioButton2"
"text": "disabled"
"enabled": false
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 2 3"
} )
add( new FormComponent( "javax.swing.JRadioButton" ) {
name: "radioButton3"
"text": "selected"
"selected": true
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 3"
} )
add( new FormComponent( "javax.swing.JRadioButton" ) {
name: "radioButton4"
"text": "selected disabled"
"selected": true
"enabled": false
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 4 3"
} )
}, new FormLayoutConstraints( null ) {
"location": new java.awt.Point( 0, 0 )
"size": new java.awt.Dimension( 580, 300 )

View File

@@ -18,12 +18,12 @@
*.background=ccffcc
*.foreground=ff0000
*.disabledText=000088
#---- Button ----
Button.background=ffffff
Button.disabledText=000088
Button.startBorderColor=ff0000
Button.endBorderColor=0000ff
@@ -39,6 +39,20 @@ Button.default.focusedBorderColor=537699
Button.default.focusColor=ff0000
#---- CheckBox ----
CheckBox.icon.borderColor=878787
CheckBox.icon.disabledBorderColor=BDBDBD
CheckBox.icon.selectedBorderColor=4982CC
CheckBox.icon.focusedBorderColor=7B9FC7
CheckBox.icon.selectedFocusedBorderColor=ACCFF7
CheckBox.icon.background=FFFFFF
CheckBox.icon.disabledBackground=F2F2F2
CheckBox.icon.selectedBackground=4D89C9
CheckBox.icon.checkmarkColor=FFFFFF
CheckBox.icon.disabledCheckmarkColor=ABABAB
#---- Component ----
Component.focusColor=97c3f3