File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes IDEs, Version Control and other tools and the fly likes NetBeans SingleFrameApplication size and loction Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Reply Bookmark "NetBeans SingleFrameApplication size and loction" Watch "NetBeans SingleFrameApplication size and loction" New topic
Author

NetBeans SingleFrameApplication size and loction

Saeed Anwar
Greenhorn

Joined: Nov 17, 2008
Posts: 5
How can I fix size and location (center on screen) for a swing application developed using Netbeans 6.1
This is a SingleFrameApplication.

Frame view at runtime is different than that I see in design view.

Thanks a lot for your help.
Vadiraj Deshpande
Ranch Hand

Joined: Aug 16, 2000
Posts: 78
HI Saeed,

You have to center your JFrame programmatically.
At the end of the JFrame constructor use this code :


This code uses the java.awt.Toolkit to get the screensize and adjusts the location of the JFrame to align the midpoints of JFrame with screen midpoints.

-Vadiraj.
Saeed Anwar
Greenhorn

Joined: Nov 17, 2008
Posts: 5
Hi Vadiraj,
Thanks a lot for the help. Code you provided works fine. However, I found another way as following which does not require any awt components and also provides a way for fixing window size.


Thanks a lot for your help.
Martin Modl
Greenhorn

Joined: Dec 07, 2010
Posts: 1
.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: NetBeans SingleFrameApplication size and loction
 
Similar Threads
reading XML layout contains a SurfaceView
Why I can't run Web Start when my class using hibernate?
problem .... Jframe application using net beans 6.5.1
[HELP] setting a new icon for SingleFrameApplication
Executable jar file not running.