This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes How to resize an application to screen size? 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 "How to resize an application to screen size?" Watch "How to resize an application to screen size?" New topic
Author

How to resize an application to screen size?

Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

Hi,

I want to know how to re size an JAVA application to the screen size of the user. There are some creations of mine which suits to the screen size of my desktop computer, but when I open them in my laptop, they are too large. I googled for a solution and found ToolKit class can do the screen re size work. But all the coded examples I found are useless, either simply printing the screen size on screen or doing something else.. Please help...Thanks


Are you better than me? Then please show me my mistakes..
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2180
    
    7
Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

Rob Camick wrote:


Hi, thanks for the reply and pardon me for the late reply. I replied yesterday but it hasn't added ..


Anyway, that methods didn't do the work. I used "Maximize_Both" option and "Iconized" options, but it didn't acheive what I really needed. After setting up that code, I tried to maximize, but what happened is it maximized the window with lot of blank space while the swing components are at the same place without getting resized. Please help...If you want me to come with a code next time, please let me know... Please help... Thanks
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18541
    
    8

Yohan Weerasinghe wrote:I tried to maximize, but what happened is it maximized the window with lot of blank space while the swing components are at the same place without getting resized.


That's probably because you wrote your code using fixed locations for your components, or something like that. So yeah, if you want to show us a simple example of your problem that would be great.
Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

Paul Clapham wrote:
Yohan Weerasinghe wrote:I tried to maximize, but what happened is it maximized the window with lot of blank space while the swing components are at the same place without getting resized.


That's probably because you wrote your code using fixed locations for your components, or something like that. So yeah, if you want to show us a simple example of your problem that would be great.


Thanks for the reply Paul. Actually the user interface is designed by NETBEANS IDE, so I will put the code here which it generated, with my editings...Anyway pardon me for the delay because I had to redo the GUI to post here....

here is the IDE generated code, with the method we talked. The method is mentioned in the constructor...




I am uploading two screenshots which shows the situation. Please help me... Thanks a lot...



[Thumbnail for Normal Size.png]


[Thumbnail for maximized view.png]

Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4531
    
    5

Same visual designer, same GroupLayout. See my remarks about both, and advice offered, in http://www.coderanch.com/t/550738/GUI/java/swing-tool-bar

luck, db
There are no new questions, but there may be new answers.
Yohan Weerasinghe
Ranch Hand

Joined: Oct 07, 2010
Posts: 499

Thanks for the reply Darryl Burke. I had a look at that thread and found the answer. Actually I have created hundreds of GUI's by hard coding, so I decided to use NETBEANS because the time is correct....

Anyhow, I got the hidden message behind that advice you have posted there. This issue happenes because I have used "Free Design" right? Ya, from next time onwards I will make sure to add layouts even though I am using an IDE.

Thanks a lot for your help, it opened my eyes......
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to resize an application to screen size?