Created
May 24, 2019 11:19
-
-
Save alifa98/58b5da7f7213b656df99cfbdbec17577 to your computer and use it in GitHub Desktop.
How to center a Jframe in swing
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
jframe.setLocationRelativeTo(null); //this should be done after setting the size or calling pack(), but before setting it visible, like this: | |
/* | |
frame.pack(); | |
frame.setLocationRelativeTo(null); | |
frame.setVisible(true); | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment