Last active
May 24, 2018 11:18
-
-
Save kleinlennart/5adbfd5e604f3ade628ad2ec275b1895 to your computer and use it in GitHub Desktop.
Template - Default Initializer for JFrame
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
public static final int WIDTH = 1280; | |
public static final int HEIGHT = 720; | |
private void initialize() { | |
frame = new JFrame(); | |
frame.setTitle("title"); | |
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | |
frame.getContentPane().setLayout(null); | |
frame.setPreferredSize(new Dimension(WIDTH, HEIGHT)); | |
frame.setMaximumSize(new Dimension(WIDTH, HEIGHT)); | |
frame.setMinimumSize(new Dimension(WIDTH, HEIGHT)); | |
frame.setResizable(false); | |
frame.setLocationRelativeTo(null); | |
frame.setFocusable(true); | |
} | |
//Proper call of setVisiible | |
public static void main(String[] args) { | |
EventQueue.invokeLater(new Runnable() { | |
public void run() { | |
try { | |
TestWindow window = new TestWindow(); | |
window.frame.setVisible(true); | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment