Created
March 8, 2019 18:52
-
-
Save devwolf75/97f529f5d0aaf5aaacae155cc5626022 to your computer and use it in GitHub Desktop.
JFrame example.
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
import javax.swing.JFrame; | |
import javax.swing.JPanel; | |
class Main { | |
private static final String TITLE = "My Game"; | |
private static final int[] DIMENSIONS = {800, 600}; | |
public static void main(String s[]) { | |
JFrame frame = new JFrame(TITLE); | |
JPanel panel = new JPanel(); | |
panel.setLayout(null); | |
frame.add(panel); | |
frame.setSize(DIMENSIONS[0], DIMENSIONS[1]); | |
frame.setLocationRelativeTo(null); | |
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | |
frame.setVisible(true); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment