aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes JFrame dont like to be 640 x 480 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JFrame dont like to be 640 x 480" Watch "JFrame dont like to be 640 x 480" New topic
Author

JFrame dont like to be 640 x 480

Vinicius Souza
Ranch Hand

Joined: May 18, 2011
Posts: 45

I am creating a JFrame at runtime and this JFrame is running a little game I made in java. The problem is that the JFrame is never the exact size you would like him to stay. Where is missing about 30 and about 15 points below the right or the window ever gets smaller. Already tried everything with setSize, setPreferredSize, null layout etc but nothing works ... Any idea?


Java is the best (I love C too) heehhh
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
use the frame only as the container.

your game should be in a JPanel with a preferredSize of 640,480
add the panel to the frame, then call
frame.pack();
rohan sethi
Ranch Hand

Joined: Dec 14, 2012
Posts: 34

Already tried everything with setSize, setPreferredSize, null layout etc but nothing works


Never use null Layout.

Try to show us some of your code, so that we can tell where the problem is.
Vinicius Souza
Ranch Hand

Joined: May 18, 2011
Posts: 45

Solve using JPanel. Thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JFrame dont like to be 640 x 480