mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-08 23:08:42 +03:00
ComboBox and Spinner: hover support
This commit is contained in:
@@ -61,6 +61,7 @@ import com.formdev.flatlaf.util.UIScale;
|
||||
* @uiDefault ComboBox.buttonEditableBackground Color
|
||||
* @uiDefault ComboBox.buttonArrowColor Color
|
||||
* @uiDefault ComboBox.buttonDisabledArrowColor Color
|
||||
* @uiDefault ComboBox.buttonHoverArrowColor Color
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
@@ -79,6 +80,7 @@ public class FlatComboBoxUI
|
||||
protected Color buttonEditableBackground;
|
||||
protected Color buttonArrowColor;
|
||||
protected Color buttonDisabledArrowColor;
|
||||
protected Color buttonHoverArrowColor;
|
||||
|
||||
public static ComponentUI createUI( JComponent c ) {
|
||||
return new FlatComboBoxUI();
|
||||
@@ -100,6 +102,7 @@ public class FlatComboBoxUI
|
||||
buttonEditableBackground = UIManager.getColor( "ComboBox.buttonEditableBackground" );
|
||||
buttonArrowColor = UIManager.getColor( "ComboBox.buttonArrowColor" );
|
||||
buttonDisabledArrowColor = UIManager.getColor( "ComboBox.buttonDisabledArrowColor" );
|
||||
buttonHoverArrowColor = UIManager.getColor( "ComboBox.buttonHoverArrowColor" );
|
||||
|
||||
// scale
|
||||
padding = UIScale.scale( padding );
|
||||
@@ -119,6 +122,7 @@ public class FlatComboBoxUI
|
||||
buttonEditableBackground = null;
|
||||
buttonArrowColor = null;
|
||||
buttonDisabledArrowColor = null;
|
||||
buttonHoverArrowColor = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -212,7 +216,8 @@ public class FlatComboBoxUI
|
||||
|
||||
@Override
|
||||
protected JButton createArrowButton() {
|
||||
return new FlatArrowButton( SwingConstants.SOUTH, buttonArrowColor, buttonDisabledArrowColor, null, null );
|
||||
return new FlatArrowButton( SwingConstants.SOUTH, buttonArrowColor,
|
||||
buttonDisabledArrowColor, buttonHoverArrowColor, null );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -55,6 +55,7 @@ import javax.swing.plaf.basic.BasicSpinnerUI;
|
||||
* @uiDefault Spinner.buttonBackground Color
|
||||
* @uiDefault Spinner.buttonArrowColor Color
|
||||
* @uiDefault Spinner.buttonDisabledArrowColor Color
|
||||
* @uiDefault Spinner.buttonHoverArrowColor Color
|
||||
* @uiDefault Spinner.padding Insets
|
||||
*
|
||||
* @author Karl Tauber
|
||||
@@ -74,6 +75,7 @@ public class FlatSpinnerUI
|
||||
protected Color buttonBackground;
|
||||
protected Color buttonArrowColor;
|
||||
protected Color buttonDisabledArrowColor;
|
||||
protected Color buttonHoverArrowColor;
|
||||
protected Insets padding;
|
||||
|
||||
public static ComponentUI createUI( JComponent c ) {
|
||||
@@ -94,6 +96,7 @@ public class FlatSpinnerUI
|
||||
buttonBackground = UIManager.getColor( "Spinner.buttonBackground" );
|
||||
buttonArrowColor = UIManager.getColor( "Spinner.buttonArrowColor" );
|
||||
buttonDisabledArrowColor = UIManager.getColor( "Spinner.buttonDisabledArrowColor" );
|
||||
buttonHoverArrowColor = UIManager.getColor( "Spinner.buttonHoverArrowColor" );
|
||||
padding = UIManager.getInsets( "Spinner.padding" );
|
||||
|
||||
// scale
|
||||
@@ -111,6 +114,7 @@ public class FlatSpinnerUI
|
||||
buttonBackground = null;
|
||||
buttonArrowColor = null;
|
||||
buttonDisabledArrowColor = null;
|
||||
buttonHoverArrowColor = null;
|
||||
padding = null;
|
||||
}
|
||||
|
||||
@@ -201,7 +205,8 @@ public class FlatSpinnerUI
|
||||
}
|
||||
|
||||
private Component createArrowButton( int direction, String name ) {
|
||||
FlatArrowButton button = new FlatArrowButton( direction, buttonArrowColor, buttonDisabledArrowColor, null, null );
|
||||
FlatArrowButton button = new FlatArrowButton( direction, buttonArrowColor,
|
||||
buttonDisabledArrowColor, buttonHoverArrowColor, null );
|
||||
button.setName( name );
|
||||
button.setYOffset( (direction == SwingConstants.NORTH) ? 1 : -1 );
|
||||
if( direction == SwingConstants.NORTH )
|
||||
|
||||
@@ -97,6 +97,7 @@ ComboBox.buttonBackground=@textComponentBackground
|
||||
ComboBox.buttonEditableBackground=404445
|
||||
ComboBox.buttonArrowColor=9A9DA1
|
||||
ComboBox.buttonDisabledArrowColor=585858
|
||||
ComboBox.buttonHoverArrowColor=bbbbbb
|
||||
|
||||
|
||||
#---- Component ----
|
||||
|
||||
@@ -275,6 +275,7 @@ Spinner.background=@textComponentBackground
|
||||
Spinner.buttonBackground=@@ComboBox.buttonEditableBackground
|
||||
Spinner.buttonArrowColor=@@ComboBox.buttonArrowColor
|
||||
Spinner.buttonDisabledArrowColor=@@ComboBox.buttonDisabledArrowColor
|
||||
Spinner.buttonHoverArrowColor=@@ComboBox.buttonHoverArrowColor
|
||||
Spinner.padding=@textComponentMargin
|
||||
|
||||
|
||||
|
||||
@@ -97,6 +97,7 @@ ComboBox.buttonBackground=@textComponentBackground
|
||||
ComboBox.buttonEditableBackground=fafafa
|
||||
ComboBox.buttonArrowColor=666666
|
||||
ComboBox.buttonDisabledArrowColor=ABABAB
|
||||
ComboBox.buttonHoverArrowColor=999999
|
||||
|
||||
|
||||
#---- Component ----
|
||||
|
||||
@@ -81,6 +81,7 @@ ComboBox.buttonBackground=f0f0f0
|
||||
ComboBox.buttonEditableBackground=cccccc
|
||||
ComboBox.buttonArrowColor=666666
|
||||
ComboBox.buttonDisabledArrowColor=ABABAB
|
||||
ComboBox.buttonHoverArrowColor=ff0000
|
||||
|
||||
|
||||
#---- Component ----
|
||||
|
||||
Reference in New Issue
Block a user