frame.setLocationRelativeTo(null) gives strange result

H

Hendrik Maryns

Hi all

Reading up on Swing. From
http://java.sun.com/docs/books/tutorial/uiswing/components/frame.html
‘How to Make Frames (Main Windows)’:

==
This example does not set the frame location, but it is easy to do so
using either the setLocationRelativeTo or setLocation method. For
example, the following code centers a frame onscreen:

frame.setLocationRelativeTo(null);
==

If I set this on my app, the window appears towards the lower right
corner of my screen. Is the jvm’s implementation broken?

I am on openSUSE 10.3, with 4 desktops. It is however the same on each
of the 4, both from the command line and from Eclipse.

I guess I’ll have to file a bug here?

H.
--
Hendrik Maryns
http://tcl.sfs.uni-tuebingen.de/~hendrik/
==================
http://aouw.org
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4-svn0 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iD8DBQFH+5V/e+7xMGD3itQRAohUAKCDXj1PNctg5zwbc2qz+u6AdRCaCwCfWnx5
Damf3TUhjGfRBP+dy6kxytk=
=oisk
-----END PGP SIGNATURE-----
 
H

Hendrik Maryns

Hendrik Maryns schreef:
Hi all

Reading up on Swing. From
http://java.sun.com/docs/books/tutorial/uiswing/components/frame.html
‘How to Make Frames (Main Windows)’:

==
This example does not set the frame location, but it is easy to do so
using either the setLocationRelativeTo or setLocation method. For
example, the following code centers a frame onscreen:

frame.setLocationRelativeTo(null);
==

If I set this on my app, the window appears towards the lower right
corner of my screen. Is the jvm’s implementation broken?

I am on openSUSE 10.3, with 4 desktops. It is however the same on each
of the 4, both from the command line and from Eclipse.

I guess I’ll have to file a bug here?

Ok, forget it, you have to set the size first, then it works.

Should have read that page to the end…

H.
--
Hendrik Maryns
http://tcl.sfs.uni-tuebingen.de/~hendrik/
==================
http://aouw.org
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.4-svn0 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org

iD8DBQFH+5gxe+7xMGD3itQRAin6AKCCYQfJ4DGACTgfLzFfMlvYQXq+hgCeN+VK
EZZP7gpQ0Wcm6fGXjvcDKvI=
=R+eo
-----END PGP SIGNATURE-----
 

Ask a Question

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.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top