Skip to content

Instantly share code, notes, and snippets.

@Badbird5907
Created June 16, 2021 18:37
Show Gist options
  • Save Badbird5907/18e2fa5b3c5b2cca4267f064ce38e7ca to your computer and use it in GitHub Desktop.
Save Badbird5907/18e2fa5b3c5b2cca4267f064ce38e7ca to your computer and use it in GitHub Desktop.
Boilerplate code to start a swing GUI
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