Click to See Complete Forum and Search --> : Gui application
inmar32
February 7th, 2010, 06:40 AM
Hey
I wrote an gui application in java .
The application work fine in the resolution of 1280X800.
But if i change the resolution for 1024X768 , the application is not shrinking , and cut from the right side.
How do i fix my application for the resolution?
Londbrok
February 8th, 2010, 01:56 AM
Can you tell us anything of how did you layout it, what components it contains (eg. scrollpanes and such)? Basically when layout is sensible, Swing components should adapt to window size changes neatly.
inmar32
February 8th, 2010, 11:27 AM
I am using free design layout.
The component inside are jpanels .
I wrote this code
_instance = new MainFrame();
_instance.setExtendedState(MAXIMIZED_BOTH);
and its still didnt help,the panels are still flowing to the right side.
keang
February 8th, 2010, 01:10 PM
By free design layout I take it you mean you aren't using a layout manager.
If that is the case then you are responsible for resizing and repositioning the components to fit the Window size that is available to you.
The advantage of layout managers is they auto position and auto size components when the window size changes but if you don't want to use them (and I've never understood why people don't want to use them - except maybe in a few very specialised cases) then you have to write this code yourself.
I'm not sure how the setExtendedState computes it's maximised value (I 've no time to investigate now, but if no one elses provides confirmation in the next few hours I'll look into it) but if it's based on the size of the components rather than the size of the screen and you aren't using a layout manager then that's probably why your app is not sizing to the screen.
dlorde
February 8th, 2010, 01:39 PM
If you could post some sample code that demonstrates the problem, perhaps we could be more specific.
When you say you are using 'free design layout', what exactly do you mean? Did you set the layout manager to null?
Bad code isn't bad, its just misunderstood...
Anon.
inmar32
February 8th, 2010, 04:59 PM
My mistake, i just saw that in free design layout , the netbeans designer uses Group layout.
For dlorde :
I created jframe (single tone ) , in the jframe using group layout to fill with jpanels.
What code exacly you want to see? (there is more then 1000 lines only in the jframe)
dlorde
February 9th, 2010, 04:28 AM
I created jframe (single tone )
Single tone? what does that mean?
What code exacly you want to see? (there is more then 1000 lines only in the jframe)
As I said, it would be useful to see sample code that demonstrates the problem. Not necessarily the full application code, but a simple, minimal but complete example that demonstrates the problem.
ETA - wait, 'single tone' == 'singleton' ?
If you want truly to understand something, try to change it...
K. Lewin
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.