Okej, here is my code I'm using, I've tried it in both j2sdk 1.4.2_4 and
1.5 beta 2 without any errors:
import java.awt.*;
import javax.swing.*;
public class test extends JFrame
{
public test()
{
this.setExtendedState(this.getExtendedState() |
this.MAXIMIZED_BOTH);
}
public static void main(String[] args)
{
//JFrame.setDefaultLookAndFeelDecorated(true);
test t = new test();
t.setVisible(true);
}
}
This should use the default decoration on windows xp (which is what im
using) and the maximized window won't cover the taskbar, however if you
uncomment the "JFrame.set..." it will use java default decoration and
the maximized window will cover the taskbar.
/Johan
Click a lite to fast on send???
not sure how u got it to compile when there are some serious syntax
errors:
first one is that it should be Frame.MAXIMIZED_BOTH and not MAXIMIZE_BOTH
second is: why is there a "|" in between shown below?
getExtendedState() | MAXIMIZE_BOTH
AaA
Click a lite to fast on send... change MAXIMIZE_BOTH to
Frame.MAXIMIZE_BOTH and import java.awt if you haven't already and it
should work, but it still covers the taskbar...
/Johan
Phaero wrote:
It compile fine for me, however it doesn't solve your problem...
/Johan
Whats up dog! wrote:
:
I have a JFrame that I would like to maximize automatically on
execution
(without clicking on the maximise button). The problem is that when
it
maximises to screen size, and goes over the windows taskbar. Is
there
a
way
of doing this without hard coding it? Sample code would be nice.
Yes, you can maximize a window without manually setting the size.
Just
do this in an AWT Frame or any subclass.
setExtendedState(getExtendedState() | MAXIMIZE_BOTH);
doesnt compile.
| <---- suppose to be || or a .?
AaA