JFrame Problem

I have make my ownclass, extends from JFrame, but I want when show method call, then It show in maximize state.
Any one can help ?
JavaBoy060299Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sgomsCommented:
how abt,

class myFrame extends JFrame{
  myFrame(){
   ////
setSize(Toolkit.getDefaultToolkit().getScreenSize().width,
Toolkit.getDefaultToolkit().getScreenSize().height);
   ////
  }
}

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jsridharCommented:
sgoms method has a small hitch:
1. x,y are not set
2. since the size of the screen is used it will cover the task bar (in windows) as well

i tried:

setBounds(-4, -4, 808, 561);

to maximize the screen at startup and it worked for Windows in 800x500 resolution.

You can run the following code and check what will be the values for your os & screen config:

import java.awt.*;

public class Test extends Frame {

  public Test() {
    super("Test");
    setSize(200, 200);
    setVisible(true);
    enableEvents(1);
  }

  protected void processEvent(AWTEvent et) {
    System.out.println(et);
    super.processEvent(et);
  }

  public static void main(String args[]) {
    new Test();
  }
}
0
JavaBoy060299Author Commented:
jsridhar,

Thanks for your comments, but I prefer sqoms solution even it will cover a taskbar.

The problem, I don't know what user's screen resolution.

What about this ?
setSize(Toolkit.getDefaultToolkit().getScreenSize().width,
Toolkit.getDefaultToolkit().getScreenSize().height);

0
JavaBoy060299Author Commented:
Thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.