DesktopIcon: use derived color for icon background, based on background color of JDesktopPane

This commit is contained in:
Karl Tauber
2021-04-11 14:48:19 +02:00
parent 7f906ba0ea
commit a7a4a19824
7 changed files with 34 additions and 6 deletions

View File

@@ -249,7 +249,7 @@ Desktop.minOnScreenInsets 3,3,3,3 javax.swing.plaf.InsetsUIResource [UI]
#---- DesktopIcon ----
DesktopIcon.background #555c68 javax.swing.plaf.ColorUIResource [UI]
DesktopIcon.background #555c68 com.formdev.flatlaf.util.DerivedColor [UI] lighten(10% autoInverse)
DesktopIcon.border [lazy] 4,4,4,4 false com.formdev.flatlaf.ui.FlatEmptyBorder [UI]
DesktopIcon.closeIcon [lazy] 24,24 com.formdev.flatlaf.icons.FlatInternalFrameCloseIcon [UI]
DesktopIcon.closeSize 20,20 javax.swing.plaf.DimensionUIResource [UI]

View File

@@ -253,7 +253,7 @@ Desktop.minOnScreenInsets 3,3,3,3 javax.swing.plaf.InsetsUIResource [UI]
#---- DesktopIcon ----
DesktopIcon.background #c6d2dd javax.swing.plaf.ColorUIResource [UI]
DesktopIcon.background #c6d2dd com.formdev.flatlaf.util.DerivedColor [UI] darken(10% autoInverse)
DesktopIcon.border [lazy] 4,4,4,4 false com.formdev.flatlaf.ui.FlatEmptyBorder [UI]
DesktopIcon.closeIcon [lazy] 24,24 com.formdev.flatlaf.icons.FlatInternalFrameCloseIcon [UI]
DesktopIcon.closeSize 20,20 javax.swing.plaf.DimensionUIResource [UI]

View File

@@ -446,7 +446,9 @@ public class FlatTestFrame
Color green = dark ? Color.green.darker() : Color.green;
updateComponentsRecur( content, (c, type) -> {
if( type == "view" || type == "tab" || c instanceof JSlider ) {
if( type == "view" || type == "tab" || c instanceof JSlider || c instanceof JInternalFrame ) {
if( c instanceof JInternalFrame )
c = ((JInternalFrame)c).getContentPane();
c.setForeground( explicit ? magenta : restoreColor );
c.setBackground( explicit ? orange : restoreColor );
} else {
@@ -620,7 +622,7 @@ public class FlatTestFrame
public static void updateComponentsRecur( Container container, BiConsumer<Component, String> action ) {
for( Component c : container.getComponents() ) {
if( c instanceof JPanel || c instanceof JDesktopPane ) {
if( c instanceof JPanel ) {
updateComponentsRecur( (Container) c, action );
continue;
}
@@ -639,6 +641,9 @@ public class FlatTestFrame
if( tab != null )
action.accept( tab, "tab" );
}
} else if( c instanceof JDesktopPane ) {
for( JInternalFrame f : ((JDesktopPane)c).getAllFrames() )
action.accept( f, null );
}
if( c instanceof JToolBar )