wood burning stoves*
The moose likes Swing / AWT / SWT and the fly likes Maximising a frame to fullscreen on start-up? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Maximising a frame to fullscreen on start-up?" Watch "Maximising a frame to fullscreen on start-up?" New topic
Author

Maximising a frame to fullscreen on start-up?

Tim frank
Greenhorn

Joined: Mar 07, 2006
Posts: 25
Hey, I've got a frame the is intended to be at fullscreen size - so who ever uses this program the frame is intended to maximise to meet the size of their screen. However I can't figure out how this is done?

Can anyone shed some light on the matter?

Regards
Jonathan Janisch
Greenhorn

Joined: Mar 17, 2007
Posts: 24


The Java Forum is a good place to search for stuff like this.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
you'll need to experiment with this


the pc I'm on now (1.4.0_01, win98se) MAXIMIZED doesn't work if set before
the frame is made visible. my home pc, 1.5.0_05, it works the other way around.

if MAXIMIZED covers your taskbar, and you don't want it to, include the
GraphicsEnvironment bit.
Tim frank
Greenhorn

Joined: Mar 07, 2006
Posts: 25
I'm using JBuilder Frame designer tool to make this program and in the code it doesnt give have a JFrame construcotr.. anywhere, So i cant change the size that way. I

n the design view the only top level components I can see are the contentPane, Jscrollpane, and Jtoolbar.

Ahh please help, this is frustrating beyond belief.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
One of the joys of using a gui-builder.

Perhaps worth posting in one of Borland's JBuilder forums.
Jonathan Janisch
Greenhorn

Joined: Mar 17, 2007
Posts: 24
Timbo, I just downloaded JBuilder just to answer your question

I have never used it before. It is JBuilder 2005 Foundation.

1) I created a new project.
2) I created a new "Frame" called "MyFrame" using the javax.swing.JFrame base class.
3) I clicked the "Design" tab.
4) I added a JLabel and JButton.

It generated the following code:



Notice: MyFrame extends JFrame. Thus, when MyFrame()'s constructor is called, JFrame's default constructor is automatically called.

I added the following code to maximize the window as in my first post and it worked as expected:



You will probably have to combine this with Michael's code to get it to work for earlier JDK's.
[ March 20, 2007: Message edited by: Jonathan Janisch ]
Jonathan Janisch
Greenhorn

Joined: Mar 17, 2007
Posts: 24
If you're going to do GUI development, I strongly suggest NetBeans. It's much more straightfoward to design a GUI out of the box using NetBeans than other Java IDE's.
Tim frank
Greenhorn

Joined: Mar 07, 2006
Posts: 25
Sorry, I'm an idiot. I was looking for the frame decloration in the wrong class... it's working fine now haha. Thanks everyone
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

"Timbo/Cicatraz" -

Welcome to the JavaRanch! We don't have many rules around the ranch, but we do have a policy on displayed names... Please adjust your displayed name to meet the JavaRanch Naming Policy. User names cannot be obviously fake and must consist of a first name and a last name.

You can change your user name here.

Thanks! and welcome to the JavaRanch!
[ March 21, 2007: Message edited by: Nathan Pruett ]

-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Maximising a frame to fullscreen on start-up?