Styling: renamed client property JComponent.style to FlatLaf.style

This commit is contained in:
Karl Tauber
2021-06-19 11:14:33 +02:00
parent b4a9c9b7f5
commit ab4c9bdeda
11 changed files with 18 additions and 18 deletions

View File

@@ -134,7 +134,7 @@ public interface FlatClientProperties
*
* @since TODO
*/
String COMPONENT_STYLE = "JComponent.style";
String STYLE = "FlatLaf.style";
/**
* Specifies minimum width of a component.

View File

@@ -155,7 +155,7 @@ public class FlatEditorPaneUI
c.revalidate();
break;
case FlatClientProperties.COMPONENT_STYLE:
case FlatClientProperties.STYLE:
applyStyle.accept( e.getNewValue() );
c.revalidate();
c.repaint();

View File

@@ -102,7 +102,7 @@ public class FlatProgressBarUI
progressBar.repaint();
break;
case COMPONENT_STYLE:
case STYLE:
applyStyle( e.getNewValue() );
progressBar.revalidate();
progressBar.repaint();

View File

@@ -131,7 +131,7 @@ public class FlatRadioButtonUI
*/
protected void propertyChange( AbstractButton b, PropertyChangeEvent e ) {
switch( e.getPropertyName() ) {
case FlatClientProperties.COMPONENT_STYLE:
case FlatClientProperties.STYLE:
applyStyle( b, this, e.getNewValue() );
break;
}

View File

@@ -193,7 +193,7 @@ public class FlatScrollBarUI
scrollbar.repaint();
break;
case FlatClientProperties.COMPONENT_STYLE:
case FlatClientProperties.STYLE:
applyStyle( e.getNewValue() );
scrollbar.revalidate();
scrollbar.repaint();

View File

@@ -109,7 +109,7 @@ public class FlatSeparatorUI
propertyChangeListener = e -> {
switch( e.getPropertyName() ) {
case FlatClientProperties.COMPONENT_STYLE:
case FlatClientProperties.STYLE:
applyStyle( s, this, e.getNewValue() );
s.revalidate();
s.repaint();

View File

@@ -190,7 +190,7 @@ public class FlatSliderUI
superListener.propertyChange( e );
switch( e.getPropertyName() ) {
case FlatClientProperties.COMPONENT_STYLE:
case FlatClientProperties.STYLE:
applyStyle( e.getNewValue() );
slider.revalidate();
slider.repaint();

View File

@@ -119,7 +119,7 @@ public class FlatSplitPaneUI
propertyChangeListener = e -> {
switch( e.getPropertyName() ) {
case FlatClientProperties.COMPONENT_STYLE:
case FlatClientProperties.STYLE:
applyStyle( e.getNewValue() );
splitPane.revalidate();
splitPane.repaint();

View File

@@ -216,7 +216,7 @@ public class FlatStyleSupport
}
public static Object getStyle( JComponent c ) {
return c.getClientProperty( FlatClientProperties.COMPONENT_STYLE );
return c.getClientProperty( FlatClientProperties.STYLE );
}
static Border cloneBorder( Border border ) {

View File

@@ -182,7 +182,7 @@ public class FlatTextFieldUI
c.revalidate();
break;
case FlatClientProperties.COMPONENT_STYLE:
case FlatClientProperties.STYLE:
applyStyle.accept( e.getNewValue() );
c.revalidate();
c.repaint();

View File

@@ -17,7 +17,7 @@
package com.formdev.flatlaf.ui;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static com.formdev.flatlaf.FlatClientProperties.COMPONENT_STYLE;
import static com.formdev.flatlaf.FlatClientProperties.STYLE;
import java.util.function.Supplier;
import javax.swing.JEditorPane;
import javax.swing.JFormattedTextField;
@@ -131,7 +131,7 @@ public class FlatTextComponentTests
String style1 = "inactiveBackground: #00ee00; disabledBackground: #0000ee";
String style2 = "inactiveBackground: #00dd00; disabledBackground: #0000dd";
c.putClientProperty( COMPONENT_STYLE, style1 );
c.putClientProperty( STYLE, style1 );
assertEquals( background, c.getBackground() );
c.setEditable( false ); assertEquals( inactiveBackground1, c.getBackground() );
@@ -139,23 +139,23 @@ public class FlatTextComponentTests
c.setEditable( true ); assertEquals( disabledBackground1, c.getBackground() );
c.setEnabled( true ); assertEquals( background, c.getBackground() );
c.putClientProperty( COMPONENT_STYLE, null );
c.putClientProperty( STYLE, null );
assertEquals( background, c.getBackground() );
c.setEditable( false );
c.putClientProperty( COMPONENT_STYLE, style1 );
c.putClientProperty( STYLE, style1 );
assertEquals( inactiveBackground1, c.getBackground() );
c.putClientProperty( COMPONENT_STYLE, null );
c.putClientProperty( STYLE, null );
assertEquals( inactiveBackground, c.getBackground() );
c.setEnabled( false );
c.putClientProperty( COMPONENT_STYLE, style1 );
c.putClientProperty( STYLE, style1 );
assertEquals( disabledBackground1, c.getBackground() );
// change from style1 to style2
c.putClientProperty( COMPONENT_STYLE, style2 );
c.putClientProperty( STYLE, style2 );
assertEquals( disabledBackground2, c.getBackground() );
c.setEnabled( true );
@@ -163,7 +163,7 @@ public class FlatTextComponentTests
// remove style
c.putClientProperty( COMPONENT_STYLE, null );
c.putClientProperty( STYLE, null );
assertEquals( inactiveBackground, c.getBackground() );
}
}