• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Maximising a frame to fullscreen on start-up?

 
Tim frank
Greenhorn
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


The Java Forum is a good place to search for stuff like this.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4632
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One of the joys of using a gui-builder.

Perhaps worth posting in one of Borland's JBuilder forums.
 
Jonathan Janisch
Greenhorn
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 25
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4121
IntelliJ IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic