mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2026-02-11 06:27:13 -06:00
Compare commits
9 Commits
3.7
...
465254c0da
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
465254c0da | ||
|
|
aaca7cace1 | ||
|
|
c995b4cbdf | ||
|
|
b251ff76e8 | ||
|
|
ea2a985481 | ||
|
|
3ca7ebbfee | ||
|
|
7e6dc269c5 | ||
|
|
7680c3a817 | ||
|
|
0e3cb95791 |
17
CHANGELOG.md
17
CHANGELOG.md
@@ -1,6 +1,23 @@
|
||||
FlatLaf Change Log
|
||||
==================
|
||||
|
||||
## 3.7.1-SNAPSHOT
|
||||
|
||||
- ComboBox: Added UI property `ComboBox.buttonFocusedEditableBackground`. (issue
|
||||
#1068)
|
||||
- Popup: Fixed scrolling popup painting issue on Windows 10 when a glass pane is
|
||||
visible and frame is maximized. (issue #1071)
|
||||
- Slider: Styling `thumbSize` or `focusWidth` did not update slider size/layout.
|
||||
(PR #1074)
|
||||
- ToolBar: Grip disappeared when switching between Look and Feels. (issue #1075)
|
||||
- Extras:
|
||||
- UI defaults inspector: Fixed NPE if color of `FlatLineBorder` is null. Also
|
||||
use `FlatLineBorder` line color as cell background color in "Value" column.
|
||||
(PR #1080)
|
||||
- `FlatDesktop`: Avoid unnecessary logging if desktop is not supported (e.g.
|
||||
on NixOS with Plasma/KDE desktop).
|
||||
|
||||
|
||||
## 3.7
|
||||
|
||||
#### New features and improvements
|
||||
|
||||
14
README.md
14
README.md
@@ -76,10 +76,16 @@ Otherwise, download `flatlaf-<version>.jar` here:
|
||||
|
||||
[](https://central.sonatype.com/artifact/com.formdev/flatlaf)
|
||||
|
||||
See also
|
||||
[Native Libraries distribution](https://www.formdev.com/flatlaf/native-libraries/)
|
||||
for instructions on how to redistribute FlatLaf native libraries with your
|
||||
application.
|
||||
- See
|
||||
[Native Libraries distribution](https://www.formdev.com/flatlaf/native-libraries/)
|
||||
for instructions on how to redistribute FlatLaf native libraries with your
|
||||
application.
|
||||
- If repackaging FlatLaf (and other) JARs into a single fat/uber JAR:
|
||||
- add `Multi-Release: true` to `META-INF/MANIFEST.MF`
|
||||
- keep `META-INF/versions/` and `META-INF/services/` directories
|
||||
- merge content of equally named files in `META-INF/services/`
|
||||
- If using obfuscation/minimizing/shrinking tools (e.g. **ProGuard** or
|
||||
**Shadow**), exclude package `com.formdev.flatlaf` and all sub-packages.
|
||||
|
||||
|
||||
### Snapshots
|
||||
|
||||
@@ -113,6 +113,7 @@ import com.formdev.flatlaf.util.SystemInfo;
|
||||
* @uiDefault ComboBox.buttonBackground Color optional
|
||||
* @uiDefault ComboBox.buttonEditableBackground Color optional
|
||||
* @uiDefault ComboBox.buttonFocusedBackground Color optional; defaults to ComboBox.focusedBackground
|
||||
* @uiDefault ComboBox.buttonFocusedEditableBackground Color optional; defaults to ComboBox.buttonEditableBackground
|
||||
* @uiDefault ComboBox.buttonSeparatorWidth int or float optional; defaults to Component.borderWidth
|
||||
* @uiDefault ComboBox.buttonSeparatorColor Color optional
|
||||
* @uiDefault ComboBox.buttonDisabledSeparatorColor Color optional
|
||||
@@ -147,6 +148,7 @@ public class FlatComboBoxUI
|
||||
@Styleable protected Color buttonBackground;
|
||||
@Styleable protected Color buttonEditableBackground;
|
||||
@Styleable protected Color buttonFocusedBackground;
|
||||
/** @since 3.7.1 */ @Styleable protected Color buttonFocusedEditableBackground;
|
||||
/** @since 2 */ @Styleable protected float buttonSeparatorWidth;
|
||||
/** @since 2 */ @Styleable protected Color buttonSeparatorColor;
|
||||
/** @since 2 */ @Styleable protected Color buttonDisabledSeparatorColor;
|
||||
@@ -258,6 +260,7 @@ public class FlatComboBoxUI
|
||||
|
||||
buttonBackground = UIManager.getColor( "ComboBox.buttonBackground" );
|
||||
buttonFocusedBackground = UIManager.getColor( "ComboBox.buttonFocusedBackground" );
|
||||
buttonFocusedEditableBackground = UIManager.getColor( "ComboBox.buttonFocusedEditableBackground" );
|
||||
buttonEditableBackground = UIManager.getColor( "ComboBox.buttonEditableBackground" );
|
||||
buttonSeparatorWidth = FlatUIUtils.getUIFloat( "ComboBox.buttonSeparatorWidth", FlatUIUtils.getUIFloat( "Component.borderWidth", 1 ) );
|
||||
buttonSeparatorColor = UIManager.getColor( "ComboBox.buttonSeparatorColor" );
|
||||
@@ -293,6 +296,7 @@ public class FlatComboBoxUI
|
||||
buttonBackground = null;
|
||||
buttonEditableBackground = null;
|
||||
buttonFocusedBackground = null;
|
||||
buttonFocusedEditableBackground = null;
|
||||
buttonSeparatorColor = null;
|
||||
buttonDisabledSeparatorColor = null;
|
||||
buttonArrowColor = null;
|
||||
@@ -587,7 +591,7 @@ public class FlatComboBoxUI
|
||||
// paint arrow button background
|
||||
if( enabled && !isCellRenderer && arrowButton.isVisible() ) {
|
||||
Color buttonColor = paintButton
|
||||
? buttonEditableBackground
|
||||
? (buttonFocusedEditableBackground != null && isPermanentFocusOwner( comboBox ) ? buttonFocusedEditableBackground : buttonEditableBackground)
|
||||
: (buttonFocusedBackground != null || focusedBackground != null) && isPermanentFocusOwner( comboBox )
|
||||
? (buttonFocusedBackground != null ? buttonFocusedBackground : focusedBackground)
|
||||
: buttonBackground;
|
||||
|
||||
@@ -108,10 +108,8 @@ public class FlatPopupFactory
|
||||
}
|
||||
}
|
||||
|
||||
boolean forceHeavyWeight = isOptionEnabled( owner, contents, FlatClientProperties.POPUP_FORCE_HEAVY_WEIGHT, "Popup.forceHeavyWeight" );
|
||||
|
||||
if( !isOptionEnabled( owner, contents, FlatClientProperties.POPUP_DROP_SHADOW_PAINTED, "Popup.dropShadowPainted" ) || SystemInfo.isProjector || SystemInfo.isWebswing )
|
||||
return new NonFlashingPopup( getPopupForScreenOfOwner( owner, contents, x, y, forceHeavyWeight ), owner, contents );
|
||||
return new NonFlashingPopup( getPopupForScreenOfOwner( owner, contents, x, y, isForceHeavyWeight( owner, contents, x, y ) ), owner, contents );
|
||||
|
||||
// macOS and Linux adds drop shadow to heavy weight popups
|
||||
if( SystemInfo.isMacOS || SystemInfo.isLinux ) {
|
||||
@@ -131,12 +129,8 @@ public class FlatPopupFactory
|
||||
return popup;
|
||||
}
|
||||
|
||||
// check whether popup overlaps a heavy weight component
|
||||
if( !forceHeavyWeight && overlapsHeavyWeightComponent( owner, contents, x, y ) )
|
||||
forceHeavyWeight = true;
|
||||
|
||||
// create drop shadow popup
|
||||
Popup popupForScreenOfOwner = getPopupForScreenOfOwner( owner, contents, x, y, forceHeavyWeight );
|
||||
Popup popupForScreenOfOwner = getPopupForScreenOfOwner( owner, contents, x, y, isForceHeavyWeight( owner, contents, x, y ) );
|
||||
GraphicsConfiguration gc = (owner != null) ? owner.getGraphicsConfiguration() : null;
|
||||
return (gc != null && gc.isTranslucencyCapable())
|
||||
? new DropShadowPopup( popupForScreenOfOwner, owner, contents )
|
||||
@@ -226,6 +220,11 @@ public class FlatPopupFactory
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isForceHeavyWeight( Component owner, Component contents, int x, int y ) {
|
||||
boolean forceHeavyWeight = isOptionEnabled( owner, contents, FlatClientProperties.POPUP_FORCE_HEAVY_WEIGHT, "Popup.forceHeavyWeight" );
|
||||
return forceHeavyWeight || hasVisibleGlassPane( owner ) || overlapsHeavyWeightComponent( owner, contents, x, y );
|
||||
}
|
||||
|
||||
private static boolean isOptionEnabled( Component owner, Component contents, String clientKey, String uiKey ) {
|
||||
Object value = getOption( owner, contents, clientKey, uiKey );
|
||||
return (value instanceof Boolean) ? (Boolean) value : false;
|
||||
@@ -469,6 +468,18 @@ public class FlatPopupFactory
|
||||
|
||||
//---- fixes --------------------------------------------------------------
|
||||
|
||||
private static boolean hasVisibleGlassPane( Component owner ) {
|
||||
if( owner == null )
|
||||
return false;
|
||||
|
||||
Window window = SwingUtilities.windowForComponent( owner );
|
||||
if( !(window instanceof RootPaneContainer) )
|
||||
return false;
|
||||
|
||||
Component glassPane = ((RootPaneContainer)window).getGlassPane();
|
||||
return (glassPane != null && glassPane.isVisible());
|
||||
}
|
||||
|
||||
private static boolean overlapsHeavyWeightComponent( Component owner, Component contents, int x, int y ) {
|
||||
if( owner == null )
|
||||
return false;
|
||||
|
||||
@@ -227,7 +227,13 @@ public class FlatSliderUI
|
||||
|
||||
/** @since 2 */
|
||||
protected void applyStyle( Object style ) {
|
||||
Dimension oldThumbSize = thumbSize;
|
||||
int oldFocusWidth = focusWidth;
|
||||
|
||||
oldStyleValues = FlatStylingSupport.parseAndApply( oldStyleValues, style, this::applyStyleProperty );
|
||||
|
||||
if( !thumbSize.equals( oldThumbSize ) || focusWidth != oldFocusWidth )
|
||||
calculateGeometry();
|
||||
}
|
||||
|
||||
/** @since 2 */
|
||||
|
||||
@@ -34,7 +34,6 @@ import java.awt.event.ComponentListener;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.event.FocusListener;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.util.Map;
|
||||
import javax.swing.Action;
|
||||
@@ -66,6 +65,7 @@ import com.formdev.flatlaf.FlatClientProperties;
|
||||
import com.formdev.flatlaf.icons.FlatCheckBoxIcon;
|
||||
import com.formdev.flatlaf.ui.FlatStylingSupport.Styleable;
|
||||
import com.formdev.flatlaf.ui.FlatStylingSupport.StyleableUI;
|
||||
import com.formdev.flatlaf.ui.FlatUIUtils.FlatPropertyWatcher;
|
||||
import com.formdev.flatlaf.util.Graphics2DProxy;
|
||||
import com.formdev.flatlaf.util.HiDPIUtils;
|
||||
import com.formdev.flatlaf.util.LoggingFacade;
|
||||
@@ -189,29 +189,26 @@ public class FlatTableUI
|
||||
if( rowHeight > 0 )
|
||||
LookAndFeel.installProperty( table, "rowHeight", UIScale.scale( rowHeight ) );
|
||||
|
||||
FlatTablePropertyWatcher watcher = FlatTablePropertyWatcher.get( table );
|
||||
if( watcher != null )
|
||||
watcher.enabled = false;
|
||||
|
||||
if( !showHorizontalLines && (watcher == null || !watcher.showHorizontalLinesChanged) ) {
|
||||
oldShowHorizontalLines = table.getShowHorizontalLines();
|
||||
table.setShowHorizontalLines( false );
|
||||
if( !showHorizontalLines ) {
|
||||
FlatPropertyWatcher.runIfNotChanged( table, "showHorizontalLines", () -> {
|
||||
oldShowHorizontalLines = table.getShowHorizontalLines();
|
||||
table.setShowHorizontalLines( false );
|
||||
} );
|
||||
}
|
||||
if( !showVerticalLines && (watcher == null || !watcher.showVerticalLinesChanged) ) {
|
||||
oldShowVerticalLines = table.getShowVerticalLines();
|
||||
table.setShowVerticalLines( false );
|
||||
if( !showVerticalLines ) {
|
||||
FlatPropertyWatcher.runIfNotChanged( table, "showVerticalLines", () -> {
|
||||
oldShowVerticalLines = table.getShowVerticalLines();
|
||||
table.setShowVerticalLines( false );
|
||||
} );
|
||||
}
|
||||
|
||||
if( intercellSpacing != null && (watcher == null || !watcher.intercellSpacingChanged) ) {
|
||||
oldIntercellSpacing = table.getIntercellSpacing();
|
||||
table.setIntercellSpacing( intercellSpacing );
|
||||
if( intercellSpacing != null ) {
|
||||
FlatPropertyWatcher.runIfNotChanged( table, "rowMargin", () -> {
|
||||
oldIntercellSpacing = table.getIntercellSpacing();
|
||||
table.setIntercellSpacing( intercellSpacing );
|
||||
} );
|
||||
}
|
||||
|
||||
if( watcher != null )
|
||||
watcher.enabled = true;
|
||||
else
|
||||
table.addPropertyChangeListener( new FlatTablePropertyWatcher() );
|
||||
|
||||
// install boolean renderer
|
||||
oldBooleanRenderer = table.getDefaultRenderer( Boolean.class );
|
||||
if( oldBooleanRenderer instanceof UIResource )
|
||||
@@ -231,25 +228,24 @@ public class FlatTableUI
|
||||
|
||||
oldStyleValues = null;
|
||||
|
||||
FlatTablePropertyWatcher watcher = FlatTablePropertyWatcher.get( table );
|
||||
if( watcher != null )
|
||||
watcher.enabled = false;
|
||||
|
||||
// restore old show horizontal/vertical lines (if not modified)
|
||||
if( !showHorizontalLines && oldShowHorizontalLines && !table.getShowHorizontalLines() &&
|
||||
(watcher == null || !watcher.showHorizontalLinesChanged) )
|
||||
table.setShowHorizontalLines( true );
|
||||
if( !showVerticalLines && oldShowVerticalLines && !table.getShowVerticalLines() &&
|
||||
(watcher == null || !watcher.showVerticalLinesChanged) )
|
||||
table.setShowVerticalLines( true );
|
||||
if( !showHorizontalLines && oldShowHorizontalLines && !table.getShowHorizontalLines() ) {
|
||||
FlatPropertyWatcher.runIfNotChanged( table, "showHorizontalLines", () -> {
|
||||
table.setShowHorizontalLines( true );
|
||||
} );
|
||||
}
|
||||
if( !showVerticalLines && oldShowVerticalLines && !table.getShowVerticalLines() ) {
|
||||
FlatPropertyWatcher.runIfNotChanged( table, "showVerticalLines", () -> {
|
||||
table.setShowVerticalLines( true );
|
||||
} );
|
||||
}
|
||||
|
||||
// restore old intercell spacing (if not modified)
|
||||
if( intercellSpacing != null && table.getIntercellSpacing().equals( intercellSpacing ) &&
|
||||
(watcher == null || !watcher.intercellSpacingChanged) )
|
||||
table.setIntercellSpacing( oldIntercellSpacing );
|
||||
|
||||
if( watcher != null )
|
||||
watcher.enabled = true;
|
||||
if( intercellSpacing != null && table.getIntercellSpacing().equals( intercellSpacing ) ) {
|
||||
FlatPropertyWatcher.runIfNotChanged( table, "rowMargin", () -> {
|
||||
table.setIntercellSpacing( oldIntercellSpacing );
|
||||
} );
|
||||
}
|
||||
|
||||
// uninstall boolean renderer
|
||||
if( table.getDefaultRenderer( Boolean.class ) instanceof FlatBooleanRenderer ) {
|
||||
@@ -938,48 +934,6 @@ public class FlatTableUI
|
||||
}
|
||||
}
|
||||
|
||||
//---- class FlatTablePropertyWatcher -------------------------------------
|
||||
|
||||
/**
|
||||
* Listener that watches for change of some table properties from application code.
|
||||
* This information is used in {@link FlatTableUI#installDefaults()} and
|
||||
* {@link FlatTableUI#uninstallDefaults()} to decide whether FlatLaf modifies those properties.
|
||||
* If they are modified in application code, FlatLaf no longer changes them.
|
||||
*
|
||||
* The listener is added once for each table, but never removed.
|
||||
* So switching Laf/theme reuses existing listener.
|
||||
*/
|
||||
private static class FlatTablePropertyWatcher
|
||||
implements PropertyChangeListener
|
||||
{
|
||||
boolean enabled = true;
|
||||
boolean showHorizontalLinesChanged;
|
||||
boolean showVerticalLinesChanged;
|
||||
boolean intercellSpacingChanged;
|
||||
|
||||
static FlatTablePropertyWatcher get( JTable table ) {
|
||||
for( PropertyChangeListener l : table.getPropertyChangeListeners() ) {
|
||||
if( l instanceof FlatTablePropertyWatcher )
|
||||
return (FlatTablePropertyWatcher) l;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
//---- interface PropertyChangeListener ----
|
||||
|
||||
@Override
|
||||
public void propertyChange( PropertyChangeEvent e ) {
|
||||
if( !enabled )
|
||||
return;
|
||||
|
||||
switch( e.getPropertyName() ) {
|
||||
case "showHorizontalLines": showHorizontalLinesChanged = true; break;
|
||||
case "showVerticalLines": showVerticalLinesChanged = true; break;
|
||||
case "rowMargin": intercellSpacingChanged = true; break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---- class FlatBooleanRenderer ------------------------------------------
|
||||
|
||||
private static class FlatBooleanRenderer
|
||||
|
||||
@@ -47,6 +47,7 @@ import javax.swing.plaf.basic.BasicToolBarUI;
|
||||
import com.formdev.flatlaf.FlatClientProperties;
|
||||
import com.formdev.flatlaf.ui.FlatStylingSupport.Styleable;
|
||||
import com.formdev.flatlaf.ui.FlatStylingSupport.StyleableUI;
|
||||
import com.formdev.flatlaf.ui.FlatUIUtils.FlatPropertyWatcher;
|
||||
import com.formdev.flatlaf.util.HiDPIUtils;
|
||||
import com.formdev.flatlaf.util.LoggingFacade;
|
||||
import com.formdev.flatlaf.util.UIScale;
|
||||
@@ -144,11 +145,13 @@ public class FlatToolBarUI
|
||||
hoverButtonGroupBackground = UIManager.getColor( "ToolBar.hoverButtonGroupBackground" );
|
||||
|
||||
// floatable
|
||||
oldFloatable = null;
|
||||
if( !UIManager.getBoolean( "ToolBar.floatable" ) ) {
|
||||
oldFloatable = toolBar.isFloatable();
|
||||
toolBar.setFloatable( false );
|
||||
} else
|
||||
oldFloatable = null;
|
||||
FlatPropertyWatcher.runIfNotChanged( toolBar, "floatable", () -> {
|
||||
oldFloatable = toolBar.isFloatable();
|
||||
toolBar.setFloatable( false );
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -158,7 +161,9 @@ public class FlatToolBarUI
|
||||
hoverButtonGroupBackground = null;
|
||||
|
||||
if( oldFloatable != null ) {
|
||||
toolBar.setFloatable( oldFloatable );
|
||||
FlatPropertyWatcher.runIfNotChanged( toolBar, "floatable", () -> {
|
||||
toolBar.setFloatable( oldFloatable );
|
||||
} );
|
||||
oldFloatable = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,8 @@ import java.awt.geom.Path2D;
|
||||
import java.awt.geom.Point2D;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.awt.geom.RoundRectangle2D;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.WeakHashMap;
|
||||
import java.util.function.Predicate;
|
||||
@@ -1413,4 +1415,47 @@ debug*/
|
||||
return delegate.isBorderOpaque();
|
||||
}
|
||||
}
|
||||
|
||||
//---- class FlatPropertyWatcher ------------------------------------------
|
||||
|
||||
/**
|
||||
* Listener that watches for change of a property from application code.
|
||||
* This information can be used to decide whether FlatLaf modifies the property.
|
||||
* If it is modified in application code, FlatLaf no longer changes it.
|
||||
* <p>
|
||||
* The listener is added once for a property, but never removed.
|
||||
* So switching Laf/theme reuses existing listener.
|
||||
*/
|
||||
static class FlatPropertyWatcher
|
||||
implements PropertyChangeListener
|
||||
{
|
||||
private boolean changed;
|
||||
|
||||
static void runIfNotChanged( JComponent c, String propName, Runnable runnable ) {
|
||||
FlatPropertyWatcher watcher = getOrInstall( c, propName );
|
||||
if( watcher.changed )
|
||||
return;
|
||||
|
||||
runnable.run();
|
||||
watcher.changed = false;
|
||||
}
|
||||
|
||||
private static FlatPropertyWatcher getOrInstall( JComponent c, String propName ) {
|
||||
for( PropertyChangeListener l : c.getPropertyChangeListeners( propName ) ) {
|
||||
if( l instanceof FlatPropertyWatcher )
|
||||
return (FlatPropertyWatcher) l;
|
||||
}
|
||||
|
||||
FlatPropertyWatcher watcher = new FlatPropertyWatcher();
|
||||
c.addPropertyChangeListener( propName, watcher );
|
||||
return watcher;
|
||||
}
|
||||
|
||||
//---- interface PropertyChangeListener ----
|
||||
|
||||
@Override
|
||||
public void propertyChange( PropertyChangeEvent e ) {
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,8 +199,9 @@ public class TestFlatStyleableInfo
|
||||
"disabledForeground", Color.class,
|
||||
|
||||
"buttonBackground", Color.class,
|
||||
"buttonFocusedBackground", Color.class,
|
||||
"buttonEditableBackground", Color.class,
|
||||
"buttonFocusedBackground", Color.class,
|
||||
"buttonFocusedEditableBackground", Color.class,
|
||||
"buttonSeparatorWidth", float.class,
|
||||
"buttonSeparatorColor", Color.class,
|
||||
"buttonDisabledSeparatorColor", Color.class,
|
||||
|
||||
@@ -388,8 +388,9 @@ public class TestFlatStyleableValue
|
||||
testColor( c, ui, "disabledForeground" );
|
||||
|
||||
testColor( c, ui, "buttonBackground" );
|
||||
testColor( c, ui, "buttonFocusedBackground" );
|
||||
testColor( c, ui, "buttonEditableBackground" );
|
||||
testColor( c, ui, "buttonFocusedBackground" );
|
||||
testColor( c, ui, "buttonFocusedEditableBackground" );
|
||||
testFloat( c, ui, "buttonSeparatorWidth" );
|
||||
testColor( c, ui, "buttonSeparatorColor" );
|
||||
testColor( c, ui, "buttonDisabledSeparatorColor" );
|
||||
|
||||
@@ -43,7 +43,8 @@ public class FlatDesktop
|
||||
public static boolean isSupported( Action action ) {
|
||||
if( SystemInfo.isJava_9_orLater ) {
|
||||
try {
|
||||
return Desktop.getDesktop().isSupported( Enum.valueOf( Desktop.Action.class, action.name() ) );
|
||||
return Desktop.isDesktopSupported() &&
|
||||
Desktop.getDesktop().isSupported( Enum.valueOf( Desktop.Action.class, action.name() ) );
|
||||
} catch( Exception ex ) {
|
||||
LoggingFacade.INSTANCE.logSevere( null, ex );
|
||||
return false;
|
||||
|
||||
@@ -777,6 +777,9 @@ public class FlatUIDefaultsInspector
|
||||
|
||||
@SuppressWarnings( "FormatString" ) // Error Prone
|
||||
private static String color2hex( Color color ) {
|
||||
if( color == null )
|
||||
return "";
|
||||
|
||||
int rgb = color.getRGB();
|
||||
boolean hasAlpha = color.getAlpha() != 255;
|
||||
|
||||
@@ -1018,28 +1021,36 @@ public class FlatUIDefaultsInspector
|
||||
item = (Item) value;
|
||||
init( table, item.key, isSelected, row );
|
||||
|
||||
// reset background, foreground and icon
|
||||
if( !(item.value instanceof Color) ) {
|
||||
// get color of value
|
||||
valueColor = null;
|
||||
if( item.value instanceof Color )
|
||||
valueColor = (item.info instanceof Color[]) ? ((Color[])item.info)[0] : (Color) item.value;
|
||||
else if( item.value instanceof FlatLineBorder )
|
||||
valueColor = ((FlatLineBorder)item.value).getLineColor();
|
||||
|
||||
// reset background and foreground
|
||||
if( valueColor == null ) {
|
||||
setBackground( null );
|
||||
setForeground( null );
|
||||
}
|
||||
if( !(item.value instanceof Icon) )
|
||||
setIcon( null );
|
||||
|
||||
// value to string
|
||||
value = item.getValueAsString();
|
||||
|
||||
super.getTableCellRendererComponent( table, value, isSelected, hasFocus, row, column );
|
||||
|
||||
if( item.value instanceof Color ) {
|
||||
Color color = (item.info instanceof Color[]) ? ((Color[])item.info)[0] : (Color) item.value;
|
||||
boolean isDark = new HSLColor( color ).getLuminance() < 70 && color.getAlpha() >= 128;
|
||||
valueColor = color;
|
||||
// set foreground, if value has color
|
||||
if( valueColor != null ) {
|
||||
boolean isDark = new HSLColor( valueColor ).getLuminance() < 70 && valueColor.getAlpha() >= 128;
|
||||
setForeground( isDark ? Color.white : Color.black );
|
||||
} else if( item.value instanceof Icon ) {
|
||||
}
|
||||
|
||||
// set icon
|
||||
if( item.value instanceof Icon ) {
|
||||
Icon icon = (Icon) item.value;
|
||||
setIcon( new SafeIcon( icon ) );
|
||||
}
|
||||
} else
|
||||
setIcon( null );
|
||||
|
||||
// set tooltip
|
||||
String toolTipText = (item.value instanceof Object[])
|
||||
@@ -1056,7 +1067,7 @@ public class FlatUIDefaultsInspector
|
||||
|
||||
@Override
|
||||
protected void paintComponent( Graphics g ) {
|
||||
if( item.value instanceof Color ) {
|
||||
if( valueColor != null ) {
|
||||
int width = getWidth();
|
||||
int height = getHeight();
|
||||
Color background = valueColor;
|
||||
|
||||
@@ -184,6 +184,7 @@ buttonDisabledArrowColor java.awt.Color
|
||||
buttonDisabledSeparatorColor java.awt.Color
|
||||
buttonEditableBackground java.awt.Color
|
||||
buttonFocusedBackground java.awt.Color
|
||||
buttonFocusedEditableBackground java.awt.Color
|
||||
buttonHoverArrowColor java.awt.Color
|
||||
buttonPressedArrowColor java.awt.Color
|
||||
buttonSeparatorColor java.awt.Color
|
||||
|
||||
@@ -235,6 +235,7 @@ ComboBox.buttonDisabledArrowColor #ababab HSL 0 0 67 javax.swing.plaf.C
|
||||
ComboBox.buttonDisabledSeparatorColor #000088 HSL 240 100 27 javax.swing.plaf.ColorUIResource [UI]
|
||||
ComboBox.buttonEditableBackground #cccccc HSL 0 0 80 javax.swing.plaf.ColorUIResource [UI]
|
||||
ComboBox.buttonFocusedBackground #ffff00 HSL 60 100 50 javax.swing.plaf.ColorUIResource [UI]
|
||||
ComboBox.buttonFocusedEditableBackground #ffff44 HSL 60 100 63 javax.swing.plaf.ColorUIResource [UI]
|
||||
ComboBox.buttonHighlight #ffffff HSL 0 0 100 javax.swing.plaf.ColorUIResource [UI]
|
||||
ComboBox.buttonHoverArrowColor #ff0000 HSL 0 100 50 javax.swing.plaf.ColorUIResource [UI]
|
||||
ComboBox.buttonPressedArrowColor #0000ff HSL 240 100 50 javax.swing.plaf.ColorUIResource [UI]
|
||||
|
||||
@@ -182,6 +182,7 @@ ComboBox.buttonEditableBackground = #ccc
|
||||
|
||||
ComboBox.focusedBackground = #ff8
|
||||
ComboBox.buttonFocusedBackground = #ff0
|
||||
ComboBox.buttonFocusedEditableBackground = #ff4
|
||||
ComboBox.popupBackground = #ffc
|
||||
|
||||
|
||||
|
||||
@@ -226,6 +226,7 @@ ComboBox.buttonDisabledArrowColor
|
||||
ComboBox.buttonDisabledSeparatorColor
|
||||
ComboBox.buttonEditableBackground
|
||||
ComboBox.buttonFocusedBackground
|
||||
ComboBox.buttonFocusedEditableBackground
|
||||
ComboBox.buttonHighlight
|
||||
ComboBox.buttonHoverArrowColor
|
||||
ComboBox.buttonPressedArrowColor
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#
|
||||
|
||||
flatlaf.releaseVersion = 3.7
|
||||
flatlaf.developmentVersion = 3.8-SNAPSHOT
|
||||
flatlaf.developmentVersion = 3.7.1-SNAPSHOT
|
||||
|
||||
org.gradle.configuration-cache = true
|
||||
# org.gradle.warning.mode = all
|
||||
|
||||
Reference in New Issue
Block a user