Testing: FlatScreenshotsBackground: also make title bar white/black

This commit is contained in:
Karl Tauber
2022-03-14 11:20:09 +01:00
parent 2ae9bb381d
commit f6b42754de

View File

@@ -24,6 +24,7 @@ import javax.swing.JFrame;
import javax.swing.KeyStroke; import javax.swing.KeyStroke;
import javax.swing.SwingConstants; import javax.swing.SwingConstants;
import javax.swing.SwingUtilities; import javax.swing.SwingUtilities;
import com.formdev.flatlaf.FlatClientProperties;
import com.formdev.flatlaf.FlatDarkLaf; import com.formdev.flatlaf.FlatDarkLaf;
import com.formdev.flatlaf.FlatLaf; import com.formdev.flatlaf.FlatLaf;
import com.formdev.flatlaf.FlatLightLaf; import com.formdev.flatlaf.FlatLightLaf;
@@ -56,20 +57,22 @@ public class FlatScreenshotsBackground
black.setOpaque( false ); black.setOpaque( false );
black.setVerticalAlignment( SwingConstants.TOP ); black.setVerticalAlignment( SwingConstants.TOP );
black.addActionListener( e -> { black.addActionListener( e -> {
if( black.isSelected() ) { if( black.isSelected() )
FlatDarkLaf.setup(); FlatDarkLaf.setup();
FlatLaf.updateUI(); else
frame.getContentPane().setBackground( Color.black );
} else {
FlatLightLaf.setup(); FlatLightLaf.setup();
FlatLaf.updateUI(); FlatLaf.updateUI();
frame.getContentPane().setBackground( Color.white );
} Color color = black.isSelected() ? Color.black : Color.white;
frame.getContentPane().setBackground( color );
frame.getRootPane().putClientProperty( FlatClientProperties.TITLE_BAR_BACKGROUND, color );
frame.repaint(); frame.repaint();
} ); } );
frame.getContentPane().add( black ); frame.getContentPane().add( black );
frame.getContentPane().setBackground( Color.white ); frame.getContentPane().setBackground( Color.white );
frame.getRootPane().putClientProperty( FlatClientProperties.TITLE_BAR_BACKGROUND, Color.white );
frame.setExtendedState( JFrame.MAXIMIZED_BOTH ); frame.setExtendedState( JFrame.MAXIMIZED_BOTH );
frame.setVisible( true ); frame.setVisible( true );
} ); } );