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