Created
June 16, 2021 18:37
-
-
Save Badbird5907/18e2fa5b3c5b2cca4267f064ce38e7ca to your computer and use it in GitHub Desktop.
Boilerplate code to start a swing GUI
This file contains hidden or 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
public BoilerPlate(){ | |
JFrame frame = new JFrame(); | |
JPanel panel = new JPanel(); | |
frame.add(panel, BorderLayout.CENTER); | |
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | |
frame.setTitle("title"); | |
try { | |
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); | |
} catch (ClassNotFoundException | UnsupportedLookAndFeelException | IllegalAccessException | InstantiationException e) { | |
e.printStackTrace(); | |
} | |
frame.pack(); | |
frame.setVisible(true); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment