Skip to content

Instantly share code, notes, and snippets.

@avh4
Created February 27, 2009 07:56
Show Gist options
  • Save avh4/71342 to your computer and use it in GitHub Desktop.
Save avh4/71342 to your computer and use it in GitHub Desktop.
Creating a window - Wintriss Tech
// Create the window
JFrame window = new JFrame("Window Title");
// Make the program exit when the window is closed
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Add the components to the window
window.add(new JButton());
window.pack();
// Put the window in the center of the screen
window.setLocationRelativeTo(null);
// Display the window
window.setVisible(true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment