Created
July 30, 2018 07:39
-
-
Save Bios-Marcel/3f00ba61543d867dec21541d549d697c to your computer and use it in GitHub Desktop.
Creating a Frame that stays in the background (Swing only)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.awt.Color; | |
import java.awt.Dimension; | |
import javax.swing.JPanel; | |
import javax.swing.JWindow; | |
public class SturdyWindow | |
{ | |
public static void main( final String[] args ) | |
{ | |
final JWindow demoWindow = new JWindow(); | |
final JPanel bigRedPanel = new JPanel(); | |
final Dimension size = new Dimension( 800, 600 ); | |
bigRedPanel.setMinimumSize( size ); | |
bigRedPanel.setPreferredSize( size ); | |
bigRedPanel.setBackground( Color.RED ); | |
demoWindow.add( bigRedPanel ); | |
demoWindow.pack(); | |
demoWindow.setVisible( true ); | |
demoWindow.toBack(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
TODO: