Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to resize an application to screen size?

 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Rob Camick
Ranch Hand
Posts: 2600
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 21139
32
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 507
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
Normal Size.png
[Thumbnail for Normal Size.png]
The normal view of the application
maximized view.png
[Thumbnail for maximized view.png]
The view when the appplication is maximized
 
Darryl Burke
Bartender
Posts: 5132
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Yohan Weerasinghe
Ranch Hand
Posts: 507
Java Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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......
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic