From 234003e2b178ab50bfaf6f34573e8db788774c0c Mon Sep 17 00:00:00 2001 From: Karl Tauber Date: Sat, 12 Dec 2020 00:33:51 +0100 Subject: [PATCH] Extras: Renamed tri-state check box class from `com.formdev.flatlaf.extras.TriStateCheckBox` to `com.formdev.flatlaf.extras.components.FlatTriStateCheckBox` --- CHANGELOG.md | 7 +++++++ .../formdev/flatlaf/demo/extras/ExtrasPanel.java | 5 +++-- .../com/formdev/flatlaf/demo/extras/ExtrasPanel.jfd | 2 +- flatlaf-extras/README.md | 2 +- .../FlatTriStateCheckBox.java} | 13 +++++++------ .../formdev/flatlaf/testing/FlatContainerTest.java | 6 +++--- .../formdev/flatlaf/testing/FlatContainerTest.jfd | 2 +- .../flatlaf/testing/FlatInternalFrameTest.java | 10 +++++----- .../flatlaf/testing/FlatInternalFrameTest.jfd | 2 +- .../com/formdev/flatlaf/testing/FlatTestFrame.java | 7 ++++--- .../com/formdev/flatlaf/testing/FlatTestFrame.jfd | 2 +- .../flatlaf/testing/extras/FlatExtrasTest.java | 9 +++++---- .../flatlaf/testing/extras/FlatExtrasTest.jfd | 4 ++-- 13 files changed, 41 insertions(+), 30 deletions(-) rename flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/{TriStateCheckBox.java => components/FlatTriStateCheckBox.java} (89%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d2b276c..f5c0a485 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,13 @@ FlatLaf Change Log ## 0.46-SNAPSHOT +#### New features and improvements + +- Extras: Renamed tri-state check box class from + `com.formdev.flatlaf.extras.TriStateCheckBox` to + `com.formdev.flatlaf.extras.components.FlatTriStateCheckBox`. + + #### Fixed bugs - Table and TableHeader: Fixed missing right vertical grid line if using table diff --git a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/extras/ExtrasPanel.java b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/extras/ExtrasPanel.java index a7291324..37cfec1f 100644 --- a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/extras/ExtrasPanel.java +++ b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/extras/ExtrasPanel.java @@ -18,6 +18,7 @@ package com.formdev.flatlaf.demo.extras; import javax.swing.*; import com.formdev.flatlaf.extras.*; +import com.formdev.flatlaf.extras.components.FlatTriStateCheckBox; import net.miginfocom.swing.*; /** @@ -63,7 +64,7 @@ public class ExtrasPanel // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents label4 = new JLabel(); label1 = new JLabel(); - triStateCheckBox1 = new TriStateCheckBox(); + triStateCheckBox1 = new FlatTriStateCheckBox(); triStateLabel1 = new JLabel(); label2 = new JLabel(); svgIconsPanel = new JPanel(); @@ -124,7 +125,7 @@ public class ExtrasPanel // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables private JLabel label4; private JLabel label1; - private TriStateCheckBox triStateCheckBox1; + private FlatTriStateCheckBox triStateCheckBox1; private JLabel triStateLabel1; private JLabel label2; private JPanel svgIconsPanel; diff --git a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/extras/ExtrasPanel.jfd b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/extras/ExtrasPanel.jfd index 80741d5c..a121bc65 100644 --- a/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/extras/ExtrasPanel.jfd +++ b/flatlaf-demo/src/main/java/com/formdev/flatlaf/demo/extras/ExtrasPanel.jfd @@ -21,7 +21,7 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 0 1" } ) - add( new FormComponent( "com.formdev.flatlaf.extras.TriStateCheckBox" ) { + add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatTriStateCheckBox" ) { name: "triStateCheckBox1" "text": "Three States" addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "triStateCheckBox1Changed", false ) ) diff --git a/flatlaf-extras/README.md b/flatlaf-extras/README.md index a4c6aeab..3e3e0c3d 100644 --- a/flatlaf-extras/README.md +++ b/flatlaf-extras/README.md @@ -7,7 +7,7 @@ This sub-project provides some additional components and classes: An icon that displays SVG using [svgSalamander](https://github.com/JFormDesigner/svgSalamander).\ ![FlatSVGIcon.png](../images/extras-FlatSVGIcon.png) -- [TriStateCheckBox](https://www.javadoc.io/doc/com.formdev/flatlaf-extras/latest/com/formdev/flatlaf/extras/TriStateCheckBox.html): +- [FlatTriStateCheckBox](https://www.javadoc.io/doc/com.formdev/flatlaf-extras/latest/com/formdev/flatlaf/extras/components/FlatTriStateCheckBox.html): A tri-state check box.\ ![TriStateCheckBox.png](../images/extras-TriStateCheckBox.png) - [FlatAnimatedLafChange](https://www.javadoc.io/doc/com.formdev/flatlaf-extras/latest/com/formdev/flatlaf/extras/FlatAnimatedLafChange.html): diff --git a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/TriStateCheckBox.java b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatTriStateCheckBox.java similarity index 89% rename from flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/TriStateCheckBox.java rename to flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatTriStateCheckBox.java index a60c45ef..781fac03 100644 --- a/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/TriStateCheckBox.java +++ b/flatlaf-extras/src/main/java/com/formdev/flatlaf/extras/components/FlatTriStateCheckBox.java @@ -14,8 +14,9 @@ * limitations under the License. */ -package com.formdev.flatlaf.extras; +package com.formdev.flatlaf.extras.components; +import static com.formdev.flatlaf.FlatClientProperties.*; import java.awt.Color; import java.awt.Graphics; import java.awt.event.ItemEvent; @@ -36,7 +37,7 @@ import com.formdev.flatlaf.FlatLaf; * * @author Karl Tauber */ -public class TriStateCheckBox +public class FlatTriStateCheckBox extends JCheckBox { public enum State { INDETERMINATE, SELECTED, UNSELECTED } @@ -44,15 +45,15 @@ public class TriStateCheckBox private State state; private boolean thirdStateEnabled = true; - public TriStateCheckBox() { + public FlatTriStateCheckBox() { this( null ); } - public TriStateCheckBox( String text ) { + public FlatTriStateCheckBox( String text ) { this( text, State.INDETERMINATE ); } - public TriStateCheckBox( String text, State initialState ) { + public FlatTriStateCheckBox( String text, State initialState ) { super( text ); setModel( new ToggleButtonModel() { @@ -89,7 +90,7 @@ public class TriStateCheckBox State oldState = this.state; this.state = state; - putClientProperty( "JButton.selectedState", state == State.INDETERMINATE ? "indeterminate" : null ); + putClientProperty( SELECTED_STATE, state == State.INDETERMINATE ? SELECTED_STATE_INDETERMINATE : null ); firePropertyChange( "state", oldState, state ); repaint(); diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatContainerTest.java b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatContainerTest.java index d1d063e5..5dc283ed 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatContainerTest.java +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatContainerTest.java @@ -22,9 +22,9 @@ import java.awt.event.MouseEvent; import javax.swing.*; import javax.swing.border.*; import com.formdev.flatlaf.FlatLaf; -import com.formdev.flatlaf.extras.TriStateCheckBox; import com.formdev.flatlaf.extras.components.FlatTabbedPane; import com.formdev.flatlaf.extras.components.FlatTabbedPane.*; +import com.formdev.flatlaf.extras.components.FlatTriStateCheckBox; import com.formdev.flatlaf.icons.FlatInternalFrameCloseIcon; import com.formdev.flatlaf.util.ScaledImageIcon; import com.jgoodies.forms.layout.*; @@ -450,7 +450,7 @@ public class FlatContainerTest tabsClosableCheckBox = new JCheckBox(); JLabel tabPlacementLabel = new JLabel(); tabPlacementField = new FlatTestEnumComboBox<>(); - secondTabClosableCheckBox = new TriStateCheckBox(); + secondTabClosableCheckBox = new FlatTriStateCheckBox(); JLabel tabAreaAlignmentLabel = new JLabel(); tabAreaAlignmentField = new FlatTestEnumComboBox<>(); tabAlignmentField = new FlatTestEnumComboBox<>(); @@ -795,7 +795,7 @@ public class FlatContainerTest private FlatTestEnumComboBox scrollButtonsPlacementField; private JCheckBox tabsClosableCheckBox; private FlatTestEnumComboBox tabPlacementField; - private TriStateCheckBox secondTabClosableCheckBox; + private FlatTriStateCheckBox secondTabClosableCheckBox; private FlatTestEnumComboBox tabAreaAlignmentField; private FlatTestEnumComboBox tabAlignmentField; private FlatTestEnumComboBox tabWidthModeField; diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatContainerTest.jfd b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatContainerTest.jfd index 1034387c..62d181c7 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatContainerTest.jfd +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatContainerTest.jfd @@ -320,7 +320,7 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 1 4" } ) - add( new FormComponent( "com.formdev.flatlaf.extras.TriStateCheckBox" ) { + add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatTriStateCheckBox" ) { name: "secondTabClosableCheckBox" "text": "Second Tab closable" auxiliary() { diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatInternalFrameTest.java b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatInternalFrameTest.java index ede122a5..c7cefe9d 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatInternalFrameTest.java +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatInternalFrameTest.java @@ -19,7 +19,7 @@ package com.formdev.flatlaf.testing; import java.awt.*; import java.beans.PropertyVetoException; import javax.swing.*; -import com.formdev.flatlaf.extras.TriStateCheckBox; +import com.formdev.flatlaf.extras.components.FlatTriStateCheckBox; import com.formdev.flatlaf.icons.FlatFileViewFloppyDriveIcon; import com.formdev.flatlaf.util.UIScale; import net.miginfocom.swing.*; @@ -63,9 +63,9 @@ public class FlatInternalFrameTest maximizableCheckBox.isSelected(), iconifiableCheckBox.isSelected() ); - if( iconCheckBox.getState() == TriStateCheckBox.State.SELECTED ) + if( iconCheckBox.getState() == FlatTriStateCheckBox.State.SELECTED ) internalFrame.setFrameIcon( new FlatFileViewFloppyDriveIcon() ); - else if( iconCheckBox.getState() == TriStateCheckBox.State.UNSELECTED ) + else if( iconCheckBox.getState() == FlatTriStateCheckBox.State.UNSELECTED ) internalFrame.setFrameIcon( null ); if( menuBarCheckBox.isSelected() ) { @@ -115,7 +115,7 @@ public class FlatInternalFrameTest closableCheckBox = new JCheckBox(); iconifiableCheckBox = new JCheckBox(); maximizableCheckBox = new JCheckBox(); - iconCheckBox = new TriStateCheckBox(); + iconCheckBox = new FlatTriStateCheckBox(); menuBarCheckBox = new JCheckBox(); titleLabel = new JLabel(); titleField = new JTextField(); @@ -207,7 +207,7 @@ public class FlatInternalFrameTest private JCheckBox closableCheckBox; private JCheckBox iconifiableCheckBox; private JCheckBox maximizableCheckBox; - private TriStateCheckBox iconCheckBox; + private FlatTriStateCheckBox iconCheckBox; private JCheckBox menuBarCheckBox; private JLabel titleLabel; private JTextField titleField; diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatInternalFrameTest.jfd b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatInternalFrameTest.jfd index d9a9a8ef..69f42896 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatInternalFrameTest.jfd +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatInternalFrameTest.jfd @@ -50,7 +50,7 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 1 1,alignx left,growx 0" } ) - add( new FormComponent( "com.formdev.flatlaf.extras.TriStateCheckBox" ) { + add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatTriStateCheckBox" ) { name: "iconCheckBox" "text": "Frame icon" }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTestFrame.java b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTestFrame.java index c6172a72..727c31c3 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTestFrame.java +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTestFrame.java @@ -43,7 +43,8 @@ import com.formdev.flatlaf.demo.LookAndFeelsComboBox; import com.formdev.flatlaf.demo.DemoPrefs; import com.formdev.flatlaf.demo.intellijthemes.*; import com.formdev.flatlaf.extras.*; -import com.formdev.flatlaf.extras.TriStateCheckBox.State; +import com.formdev.flatlaf.extras.components.FlatTriStateCheckBox; +import com.formdev.flatlaf.extras.components.FlatTriStateCheckBox.State; import com.formdev.flatlaf.ui.FlatUIUtils; import com.formdev.flatlaf.util.SystemInfo; import com.formdev.flatlaf.util.UIScale; @@ -660,7 +661,7 @@ public class FlatTestFrame inspectCheckBox = new JCheckBox(); explicitColorsCheckBox = new JCheckBox(); backgroundCheckBox = new JCheckBox(); - opaqueTriStateCheckBox = new TriStateCheckBox(); + opaqueTriStateCheckBox = new FlatTriStateCheckBox(); sizeVariantComboBox = new JComboBox<>(); closeButton = new JButton(); themesPanel = new IJThemesPanel(); @@ -805,7 +806,7 @@ public class FlatTestFrame private JCheckBox inspectCheckBox; private JCheckBox explicitColorsCheckBox; private JCheckBox backgroundCheckBox; - private TriStateCheckBox opaqueTriStateCheckBox; + private FlatTriStateCheckBox opaqueTriStateCheckBox; private JComboBox sizeVariantComboBox; private JButton closeButton; private IJThemesPanel themesPanel; diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTestFrame.jfd b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTestFrame.jfd index e174c4d5..03eb55b1 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTestFrame.jfd +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/FlatTestFrame.jfd @@ -107,7 +107,7 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 7 0" } ) - add( new FormComponent( "com.formdev.flatlaf.extras.TriStateCheckBox" ) { + add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatTriStateCheckBox" ) { name: "opaqueTriStateCheckBox" "text": "opaque" "mnemonic": 79 diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/extras/FlatExtrasTest.java b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/extras/FlatExtrasTest.java index 14da1a5d..098ae845 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/extras/FlatExtrasTest.java +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/extras/FlatExtrasTest.java @@ -18,6 +18,7 @@ package com.formdev.flatlaf.testing.extras; import javax.swing.*; import com.formdev.flatlaf.extras.*; +import com.formdev.flatlaf.extras.components.*; import com.formdev.flatlaf.testing.*; import net.miginfocom.swing.*; @@ -117,9 +118,9 @@ public class FlatExtrasTest private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents label1 = new JLabel(); - triStateCheckBox1 = new TriStateCheckBox(); + triStateCheckBox1 = new FlatTriStateCheckBox(); triStateLabel1 = new JLabel(); - triStateCheckBox2 = new TriStateCheckBox(); + triStateCheckBox2 = new FlatTriStateCheckBox(); triStateLabel2 = new JLabel(); label2 = new JLabel(); svgIconsPanel = new JPanel(); @@ -238,9 +239,9 @@ public class FlatExtrasTest // JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables private JLabel label1; - private TriStateCheckBox triStateCheckBox1; + private FlatTriStateCheckBox triStateCheckBox1; private JLabel triStateLabel1; - private TriStateCheckBox triStateCheckBox2; + private FlatTriStateCheckBox triStateCheckBox2; private JLabel triStateLabel2; private JLabel label2; private JPanel svgIconsPanel; diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/extras/FlatExtrasTest.jfd b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/extras/FlatExtrasTest.jfd index fc34f236..0f0c2222 100644 --- a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/extras/FlatExtrasTest.jfd +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/extras/FlatExtrasTest.jfd @@ -15,7 +15,7 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 0 0" } ) - add( new FormComponent( "com.formdev.flatlaf.extras.TriStateCheckBox" ) { + add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatTriStateCheckBox" ) { name: "triStateCheckBox1" "text": "three states" addEvent( new FormEvent( "java.awt.event.ActionListener", "actionPerformed", "triStateCheckBox1Changed", false ) ) @@ -29,7 +29,7 @@ new FormModel { }, new FormLayoutConstraints( class net.miginfocom.layout.CC ) { "value": "cell 2 0,gapx 30" } ) - add( new FormComponent( "com.formdev.flatlaf.extras.TriStateCheckBox" ) { + add( new FormComponent( "com.formdev.flatlaf.extras.components.FlatTriStateCheckBox" ) { name: "triStateCheckBox2" "text": "third state disabled" "thirdStateEnabled": false