FlatComponentsTest: add checkbox to change contentAreaFilled of all buttons (for issue #58)

This commit is contained in:
Karl Tauber
2020-02-11 18:44:35 +01:00
parent 22c06300f1
commit 23c30ec46d
2 changed files with 28 additions and 0 deletions

View File

@@ -54,6 +54,15 @@ public class FlatComponentsTest
progressBar4.setIndeterminate( indeterminate );
}
private void contentAreaFilledChanged() {
boolean contentAreaFilled = contentAreaFilledCheckBox.isSelected();
for( Component c : getComponents() ) {
if( c instanceof AbstractButton )
((AbstractButton)c).setContentAreaFilled( contentAreaFilled );
}
}
private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents
JLabel labelLabel = new JLabel();
@@ -90,6 +99,7 @@ public class FlatComponentsTest
JRadioButton radioButton2 = new JRadioButton();
JRadioButton radioButton3 = new JRadioButton();
JRadioButton radioButton4 = new JRadioButton();
contentAreaFilledCheckBox = new JCheckBox();
JLabel comboBoxLabel = new JLabel();
JComboBox<String> comboBox1 = new JComboBox<>();
JComboBox<String> comboBox2 = new JComboBox<>();
@@ -408,6 +418,12 @@ public class FlatComponentsTest
radioButton4.setEnabled(false);
add(radioButton4, "cell 4 4");
//---- contentAreaFilledCheckBox ----
contentAreaFilledCheckBox.setText("contentAreaFilled");
contentAreaFilledCheckBox.setSelected(true);
contentAreaFilledCheckBox.addActionListener(e -> contentAreaFilledChanged());
add(contentAreaFilledCheckBox, "cell 5 4");
//---- comboBoxLabel ----
comboBoxLabel.setText("JComboBox:");
add(comboBoxLabel, "cell 0 5");
@@ -974,6 +990,7 @@ public class FlatComponentsTest
}
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
private JCheckBox contentAreaFilledCheckBox;
private JProgressBar progressBar3;
private JProgressBar progressBar4;
private JSlider slider3;

View File

@@ -258,6 +258,17 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 4 4"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "contentAreaFilledCheckBox"
"text": "contentAreaFilled"
"selected": true
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "contentAreaFilledChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 5 4"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "comboBoxLabel"
"text": "JComboBox:"