Created
          February 27, 2009 07:56 
        
      - 
      
- 
        Save avh4/71342 to your computer and use it in GitHub Desktop. 
    Creating a window - Wintriss Tech
  
        
  
    
      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
    
  
  
    
  | // 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