P
palmis
How can I create a JFrame that is centered on the
screen?
It appear up on the left corner of screen. Why?
Palmis
screen?
It appear up on the left corner of screen. Why?
Palmis
JFrame frame = ...;palmis said:How can I create a JFrame that is centered on the
screen?
Because the default position of a JFrame is (0,0).It appear up on the left corner of screen. Why?
Thomas said:JFrame frame = ...;
frame.setLocationRelativeTo(null);
See the API doc of java.awt.Window#setLocationRelativeTo.
JFrame inherits that method from java.awt.Window.
Because the default position of a JFrame is (0,0).
How can I create a JFrame that is centered on the
screen?
It appear up on the left corner of screen. Why?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.