File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JFrame dont like to be 640 x 480

 
Vinicius Souza
Ranch Hand
Posts: 70
1
Chrome Java Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Michael Dunn
Ranch Hand
Posts: 4632
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 34
Java Netbeans IDE Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 70
1
Chrome Java Netbeans IDE
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Solve using JPanel. Thanks!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic