Extras: Renamed tri-state check box class from

`com.formdev.flatlaf.extras.TriStateCheckBox` to
`com.formdev.flatlaf.extras.components.FlatTriStateCheckBox`
This commit is contained in:
Karl Tauber
2020-12-12 00:33:51 +01:00
parent 534384438b
commit 234003e2b1
13 changed files with 41 additions and 30 deletions

View File

@@ -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):

View File

@@ -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();