mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-08 06:50:56 +03:00
Testing: FlatScreenshotsBackground: also make title bar white/black
This commit is contained in:
@@ -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 );
|
||||||
} );
|
} );
|
||||||
|
|||||||
Reference in New Issue
Block a user