Extras: added extension class for JProgressBar (issue #117)

This commit is contained in:
Karl Tauber
2020-12-11 13:28:55 +01:00
parent 3a8b30ca8e
commit 1323b46ac7
4 changed files with 132 additions and 13 deletions

View File

@@ -56,6 +56,22 @@ public class FlatComponentsTest
progressBar4.setIndeterminate( indeterminate );
}
private void squareChanged() {
boolean square = squareCheckBox.isSelected();
progressBar1.setSquare( square );
progressBar2.setSquare( square );
progressBar3.setSquare( square );
progressBar4.setSquare( square );
}
private void largeHeightChanged() {
boolean largeHeight = largeHeightCheckBox.isSelected();
progressBar1.setLargeHeight( largeHeight );
progressBar2.setLargeHeight( largeHeight );
progressBar3.setLargeHeight( largeHeight );
progressBar4.setLargeHeight( largeHeight );
}
private void borderPaintedChanged() {
boolean borderPainted = borderPaintedCheckBox.isSelected();
@@ -254,8 +270,8 @@ public class FlatComponentsTest
JSlider slider2 = new JSlider();
JSlider slider4 = new JSlider();
JScrollPane scrollPane14 = new JScrollPane();
progressBar3 = new JProgressBar();
progressBar4 = new JProgressBar();
progressBar3 = new FlatProgressBar();
progressBar4 = new FlatProgressBar();
JToolBar toolBar2 = new JToolBar();
JButton button9 = new JButton();
JButton button10 = new JButton();
@@ -291,12 +307,14 @@ public class FlatComponentsTest
slider3 = new JSlider();
JSlider slider5 = new JSlider();
JLabel progressBarLabel = new JLabel();
progressBar1 = new JProgressBar();
progressBar2 = new JProgressBar();
progressBar1 = new FlatProgressBar();
progressBar2 = new FlatProgressBar();
indeterminateCheckBox = new JCheckBox();
squareCheckBox = new JCheckBox();
JLabel toolTipLabel = new JLabel();
JToolTip toolTip1 = new JToolTip();
JToolTip toolTip2 = new JToolTip();
largeHeightCheckBox = new JCheckBox();
JLabel toolBarLabel = new JLabel();
JToolBar toolBar1 = new JToolBar();
JButton button4 = new JButton();
@@ -1249,6 +1267,11 @@ public class FlatComponentsTest
indeterminateCheckBox.addActionListener(e -> indeterminateProgress());
add(indeterminateCheckBox, "cell 4 21");
//---- squareCheckBox ----
squareCheckBox.setText("square");
squareCheckBox.addActionListener(e -> squareChanged());
add(squareCheckBox, "cell 4 21");
//---- toolTipLabel ----
toolTipLabel.setText("JToolTip:");
add(toolTipLabel, "cell 0 22");
@@ -1261,6 +1284,11 @@ public class FlatComponentsTest
toolTip2.setTipText("Tool tip with\nmultiple\nlines.");
add(toolTip2, "cell 1 22 3 1");
//---- largeHeightCheckBox ----
largeHeightCheckBox.setText("large height");
largeHeightCheckBox.addActionListener(e -> largeHeightChanged());
add(largeHeightCheckBox, "cell 4 22,aligny top,growy 0");
//---- toolBarLabel ----
toolBarLabel.setText("JToolBar:");
add(toolBarLabel, "cell 0 23");
@@ -1389,8 +1417,8 @@ public class FlatComponentsTest
// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
private JTextField textField1;
private JProgressBar progressBar3;
private JProgressBar progressBar4;
private FlatProgressBar progressBar3;
private FlatProgressBar progressBar4;
private JComboBox<String> buttonTypeComboBox;
private JCheckBox borderPaintedCheckBox;
private JCheckBox roundRectCheckBox;
@@ -1402,9 +1430,11 @@ public class FlatComponentsTest
private JRadioButton magentaCyanOutlineRadioButton;
private JCheckBox focusPaintedCheckBox;
private JSlider slider3;
private JProgressBar progressBar1;
private JProgressBar progressBar2;
private FlatProgressBar progressBar1;
private FlatProgressBar progressBar2;
private JCheckBox indeterminateCheckBox;
private JCheckBox squareCheckBox;
private JCheckBox largeHeightCheckBox;
// JFormDesigner - End of variables declaration //GEN-END:variables
//---- class TestDefaultButton --------------------------------------------

View File

@@ -1,4 +1,4 @@
JFDML JFormDesigner: "7.0.2.0.298" Java: "15" encoding: "UTF-8"
JFDML JFormDesigner: "7.0.3.0.337" Java: "15" encoding: "UTF-8"
new FormModel {
contentType: "form/swing"
@@ -892,7 +892,7 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 3 13,grow"
} )
add( new FormComponent( "javax.swing.JProgressBar" ) {
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatProgressBar" ) {
name: "progressBar3"
"orientation": 1
"value": 60
@@ -902,7 +902,7 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 4 13 1 6,growy"
} )
add( new FormComponent( "javax.swing.JProgressBar" ) {
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatProgressBar" ) {
name: "progressBar4"
"orientation": 1
"value": 60
@@ -1187,7 +1187,7 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 0 21"
} )
add( new FormComponent( "javax.swing.JProgressBar" ) {
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatProgressBar" ) {
name: "progressBar1"
"value": 60
auxiliary() {
@@ -1196,7 +1196,7 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 21 3 1,growx"
} )
add( new FormComponent( "javax.swing.JProgressBar" ) {
add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatProgressBar" ) {
name: "progressBar2"
"stringPainted": true
"value": 60
@@ -1216,6 +1216,16 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 4 21"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "squareCheckBox"
"text": "square"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "squareChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 4 21"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "toolTipLabel"
"text": "JToolTip:"
@@ -1234,6 +1244,16 @@ new FormModel {
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 1 22 3 1"
} )
add( new FormComponent( "javax.swing.JCheckBox" ) {
name: "largeHeightCheckBox"
"text": "large height"
auxiliary() {
"JavaCodeGenerator.variableLocal": false
}
addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "largeHeightChanged", false ) )
}, new FormLayoutConstraints( class net.miginfocom.layout.CC ) {
"value": "cell 4 22,aligny top,growy 0"
} )
add( new FormComponent( "javax.swing.JLabel" ) {
name: "toolBarLabel"
"text": "JToolBar:"