I'm working with JDesktopPane
's and JInternalFrame
's and I'm having some difficulty centering the frames in the desktop. What I've found is that when I determine the center of the desktop using getWidth()
and getHeight()
, the position I get is the center of the desktop if the JFrame
wasn't maximized. Is there a way to get the 'real' dimensions of the desktop?
Asked
Active
Viewed 138 times
1

mKorbel
- 109,525
- 20
- 134
- 319

FlyingMonkey
- 51
- 8
-
Consider providing a [runnable example](https://stackoverflow.com/help/mcve) which demonstrates your problem. This will result in less confusion and better responses. `JDesktop` doesn't have a concept of "scrollable", although it allows views to positioned outside it's viewable area, it doesn't provide a means by which you can access those frames. – MadProgrammer Oct 19 '14 at 07:39
-
MadProgrammer means `JDesktopPane` instead of `JDesktop` :) – user1803551 Oct 19 '14 at 08:26
-
@user1803551 Yeah, no one knows what I mean, least of all myself ;) – MadProgrammer Oct 19 '14 at 08:27
1 Answers
0
Okay, after several hours of debugging, I figured out what the problem was: The JFrame
wasn't made visible until after I had finished adding/positioning everything, so it wasn't set to it's maximized size.

FlyingMonkey
- 51
- 8
-
1Which would have been easily fixed had you Consider providing a [runnable example](https://stackoverflow.com/help/mcve) which demonstrated your problem, saving you several hours of joy and happiness... – MadProgrammer Oct 19 '14 at 23:59
-
@MadProgrammer I figured out what the problem was when I tried to make a runnable example and couldn't replicate the issue at first. – FlyingMonkey Oct 20 '14 at 04:03