mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 14:37:13 -06:00
IntelliJ Themes: OptionPane: use colors for error/information/question/warning icons from default color palette, which enables modification of icon colors by theme
This commit is contained in:
@@ -22,11 +22,12 @@ import java.awt.Graphics2D;
|
||||
import java.awt.Shape;
|
||||
import java.awt.geom.Path2D;
|
||||
import javax.swing.UIManager;
|
||||
import com.formdev.flatlaf.ui.FlatUIUtils;
|
||||
|
||||
/**
|
||||
* Base class for icons for {@link javax.swing.JOptionPane}.
|
||||
*
|
||||
* @uiDefault OptionPane.icon.foreground Color
|
||||
* @uiDefault OptionPane.icon.foreground Color default is transparent
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
@@ -35,8 +36,8 @@ public abstract class FlatOptionPaneAbstractIcon
|
||||
{
|
||||
protected final Color foreground = UIManager.getColor( "OptionPane.icon.foreground" );
|
||||
|
||||
protected FlatOptionPaneAbstractIcon( String colorKey ) {
|
||||
super( 32, 32, UIManager.getColor( colorKey ) );
|
||||
protected FlatOptionPaneAbstractIcon( String colorKey, String defaultColorKey ) {
|
||||
super( 32, 32, FlatUIUtils.getUIColor( colorKey, defaultColorKey ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -24,7 +24,8 @@ import java.awt.geom.Rectangle2D;
|
||||
/**
|
||||
* "Error" icon for {@link javax.swing.JOptionPane}.
|
||||
*
|
||||
* @uiDefault OptionPane.icon.errorColor Color
|
||||
* @uiDefault OptionPane.icon.errorColor Color optional; defaults to Actions.Red
|
||||
* @uiDefault Actions.Red Color
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
@@ -32,7 +33,7 @@ public class FlatOptionPaneErrorIcon
|
||||
extends FlatOptionPaneAbstractIcon
|
||||
{
|
||||
public FlatOptionPaneErrorIcon() {
|
||||
super( "OptionPane.icon.errorColor" );
|
||||
super( "OptionPane.icon.errorColor", "Actions.Red" );
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -24,7 +24,8 @@ import java.awt.geom.Rectangle2D;
|
||||
/**
|
||||
* "Information" icon for {@link javax.swing.JOptionPane}.
|
||||
*
|
||||
* @uiDefault OptionPane.icon.informationColor Color
|
||||
* @uiDefault OptionPane.icon.informationColor Color optional; defaults to Actions.Blue
|
||||
* @uiDefault Actions.Blue Color
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
@@ -32,7 +33,7 @@ public class FlatOptionPaneInformationIcon
|
||||
extends FlatOptionPaneAbstractIcon
|
||||
{
|
||||
public FlatOptionPaneInformationIcon() {
|
||||
super( "OptionPane.icon.informationColor" );
|
||||
super( "OptionPane.icon.informationColor", "Actions.Blue" );
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -24,7 +24,8 @@ import java.awt.geom.Rectangle2D;
|
||||
/**
|
||||
* "Question" icon for {@link javax.swing.JOptionPane}.
|
||||
*
|
||||
* @uiDefault OptionPane.icon.questionColor Color
|
||||
* @uiDefault OptionPane.icon.questionColor Color optional; defaults to Actions.Blue
|
||||
* @uiDefault Actions.Blue Color
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
@@ -32,7 +33,7 @@ public class FlatOptionPaneQuestionIcon
|
||||
extends FlatOptionPaneAbstractIcon
|
||||
{
|
||||
public FlatOptionPaneQuestionIcon() {
|
||||
super( "OptionPane.icon.questionColor" );
|
||||
super( "OptionPane.icon.questionColor", "Actions.Blue" );
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -24,7 +24,8 @@ import com.formdev.flatlaf.ui.FlatUIUtils;
|
||||
/**
|
||||
* "Warning" icon for {@link javax.swing.JOptionPane}.
|
||||
*
|
||||
* @uiDefault OptionPane.icon.warningColor Color
|
||||
* @uiDefault OptionPane.icon.warningColor Color optional; defaults to Actions.Yellow
|
||||
* @uiDefault Actions.Yellow Color
|
||||
*
|
||||
* @author Karl Tauber
|
||||
*/
|
||||
@@ -32,7 +33,7 @@ public class FlatOptionPaneWarningIcon
|
||||
extends FlatOptionPaneAbstractIcon
|
||||
{
|
||||
public FlatOptionPaneWarningIcon() {
|
||||
super( "OptionPane.icon.warningColor" );
|
||||
super( "OptionPane.icon.warningColor", "Actions.Yellow" );
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -91,6 +91,11 @@ public class FlatUIUtils
|
||||
return (color != null) ? color : defaultColor;
|
||||
}
|
||||
|
||||
public static Color getUIColor( String key, String defaultKey ) {
|
||||
Color color = UIManager.getColor( key );
|
||||
return (color != null) ? color : UIManager.getColor( defaultKey );
|
||||
}
|
||||
|
||||
public static int getUIInt( String key, int defaultValue ) {
|
||||
Object value = UIManager.get( key );
|
||||
return (value instanceof Integer) ? (Integer) value : defaultValue;
|
||||
|
||||
@@ -146,15 +146,6 @@ MenuItemCheckBox.icon.checkmarkColor=A7A7A7
|
||||
MenuItemCheckBox.icon.disabledCheckmarkColor=606060
|
||||
|
||||
|
||||
#---- OptionPane ----
|
||||
|
||||
OptionPane.icon.errorColor=C75450
|
||||
OptionPane.icon.informationColor=3592C4
|
||||
OptionPane.icon.questionColor=3592C4
|
||||
OptionPane.icon.warningColor=F0A732
|
||||
OptionPane.icon.foreground=null
|
||||
|
||||
|
||||
#---- PopupMenu ----
|
||||
|
||||
PopupMenu.borderColor=515151
|
||||
|
||||
@@ -153,15 +153,6 @@ MenuItemCheckBox.icon.checkmarkColor=4D89C9
|
||||
MenuItemCheckBox.icon.disabledCheckmarkColor=ABABAB
|
||||
|
||||
|
||||
#---- OptionPane ----
|
||||
|
||||
OptionPane.icon.errorColor=DB5860
|
||||
OptionPane.icon.informationColor=389FD6
|
||||
OptionPane.icon.questionColor=389FD6
|
||||
OptionPane.icon.warningColor=EDA200
|
||||
OptionPane.icon.foreground=null
|
||||
|
||||
|
||||
#---- PopupMenu ----
|
||||
|
||||
PopupMenu.borderColor=cdcdcd
|
||||
|
||||
Reference in New Issue
Block a user