mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-06 14:00:55 +03:00
Styling: renamed client property JComponent.style to FlatLaf.style
This commit is contained in:
@@ -134,7 +134,7 @@ public interface FlatClientProperties
|
||||
*
|
||||
* @since TODO
|
||||
*/
|
||||
String COMPONENT_STYLE = "JComponent.style";
|
||||
String STYLE = "FlatLaf.style";
|
||||
|
||||
/**
|
||||
* Specifies minimum width of a component.
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -102,7 +102,7 @@ public class FlatProgressBarUI
|
||||
progressBar.repaint();
|
||||
break;
|
||||
|
||||
case COMPONENT_STYLE:
|
||||
case STYLE:
|
||||
applyStyle( e.getNewValue() );
|
||||
progressBar.revalidate();
|
||||
progressBar.repaint();
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ public class FlatScrollBarUI
|
||||
scrollbar.repaint();
|
||||
break;
|
||||
|
||||
case FlatClientProperties.COMPONENT_STYLE:
|
||||
case FlatClientProperties.STYLE:
|
||||
applyStyle( e.getNewValue() );
|
||||
scrollbar.revalidate();
|
||||
scrollbar.repaint();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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 ) {
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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() );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user