diff --git a/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/screenshots/FlatScreenshotsBackground.java b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/screenshots/FlatScreenshotsBackground.java new file mode 100644 index 00000000..b517be7f --- /dev/null +++ b/flatlaf-testing/src/main/java/com/formdev/flatlaf/testing/screenshots/FlatScreenshotsBackground.java @@ -0,0 +1,77 @@ +/* + * Copyright 2021 FormDev Software GmbH + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.formdev.flatlaf.testing.screenshots; + +import java.awt.Color; +import java.awt.event.KeyEvent; +import javax.swing.JCheckBox; +import javax.swing.JComponent; +import javax.swing.JFrame; +import javax.swing.KeyStroke; +import javax.swing.SwingConstants; +import javax.swing.SwingUtilities; +import com.formdev.flatlaf.FlatDarkLaf; +import com.formdev.flatlaf.FlatLaf; +import com.formdev.flatlaf.FlatLightLaf; + +/** + * Fills entire screen with white or black. + * Use as background when tacking screenshots to avoid that light/dark background + * shines through window border. + * + * @author Karl Tauber + */ +public class FlatScreenshotsBackground +{ + public static void main( String[] args ) { + SwingUtilities.invokeLater( () -> { + FlatLightLaf.setup(); + + JFrame frame = new JFrame( "FlatScreenshotsBackground" ); + frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); + + // register ESC key to close frame + ((JComponent)frame.getContentPane()).registerKeyboardAction( + e -> { + System.exit( 0 ); + }, + KeyStroke.getKeyStroke( KeyEvent.VK_ESCAPE, 0, false ), + JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT ); + + JCheckBox black = new JCheckBox( "black" ); + black.setOpaque( false ); + black.setVerticalAlignment( SwingConstants.TOP ); + black.addActionListener( e -> { + if( black.isSelected() ) { + FlatDarkLaf.setup(); + FlatLaf.updateUI(); + frame.getContentPane().setBackground( Color.black ); + } else { + FlatLightLaf.setup(); + FlatLaf.updateUI(); + frame.getContentPane().setBackground( Color.white ); + } + frame.repaint(); + } ); + frame.getContentPane().add( black ); + + frame.getContentPane().setBackground( Color.white ); + frame.setExtendedState( JFrame.MAXIMIZED_BOTH ); + frame.setVisible( true ); + } ); + } +} diff --git a/images/FlatDarkSwingXTest.png b/images/FlatDarkSwingXTest.png index 7e1e9f6e..5cc37d5f 100644 Binary files a/images/FlatDarkSwingXTest.png and b/images/FlatDarkSwingXTest.png differ diff --git a/images/carbon.png b/images/carbon.png index b4081a84..b02d9e31 100644 Binary files a/images/carbon.png and b/images/carbon.png differ diff --git a/images/dark_purple.png b/images/dark_purple.png index 8f126b4a..2ada70d7 100644 Binary files a/images/dark_purple.png and b/images/dark_purple.png differ diff --git a/images/flat_dark.png b/images/flat_dark.png index c97b321b..ea742dce 100644 Binary files a/images/flat_dark.png and b/images/flat_dark.png differ diff --git a/images/intellij_platform_themes.png b/images/intellij_platform_themes.png index 9aab2e0d..49e69662 100644 Binary files a/images/intellij_platform_themes.png and b/images/intellij_platform_themes.png differ diff --git a/images/one_dark.png b/images/one_dark.png index 548c5128..e54bcee2 100644 Binary files a/images/one_dark.png and b/images/one_dark.png differ