Does anyone know how to maximize a JWindow through code?
Printable View
Does anyone know how to maximize a JWindow through code?
That is a good question. A JWindow is usually used to display somthing that needs to be in it's own window without the adornments added by a JFrame. You would have to move or close this window programmatically because of the absence of the close, min, and max buttons.
I don't think that there is a way to maximize a JWindow from the window itself. You would have to provide an alternate button for the action and then scale the JWindow to the size of the screen.
Scaling a window to the screen size is not the same as maximizing.
But there seems to be no way of maximizing a JWindow. Why do you want to do it?
Sure it is. :p Take Explorer when in full screen and click restore, the button changes to maximize. Click maximize and the window is scaled back to the screen size.Quote:
Posted by CornedBee
Scaling a window to the screen size is not the same as maximizing.
???
I don't use IE. :p
Windows maintains an internal state of a window, including if it is maximized or not. This state is not changed when you just resize the window. It has a few effects, like that a maximized window can not be moved or resized.
But since a JWindow doesn't have a title bar, a resizable frame or any buttons resizing to screen size has the same effect as maximizing. Only the same effect, mind you, from the perspective of Windows it's not the same.
Well thats all I want is to "setSize" the JWindow, or JFrame to the size of the screen.
To get the size of the screen use this
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Well thank you, that works.
No problem ;)