Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

resize window distorts view  RSS feed

 
Shannon Sims
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
When I expand or shrink my window, my JTABLE and JFIELDs become distorted. Would someone please explain why and how I can correct it?

Thank you!
 
Hari Surendran
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am assuming that you use a GridBag Layout and trying to resize the Window. Most other layouts are simple and have pre-designed UI behaviour.

The widgets are getting distorted because they themselves are getting resized. A text field can only shrink so much without losing its form. The things to consider are the spacing between UI controls, weights etc to optimize the resize behaviour.

That being said, if you resize beyond a point the controls will be distorted. That is where the scroll bars kick in. One trick is to identify the size where the controls starts getting distorted and using the scroll bars then onwards so that there is no more distortion.

If you look at a microsoft application, they typically always use scroll bars. There is no resizing of controls, only the window gets resized and the controls gets progressively hiddedn behind the scroll bars. Now you will need to scroll vertical or horizontal to view it.

Another option is to disable resizing. Of course, the individual requirements vary and that may not suit your design.
 
Shannon Sims
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Hari,
Brilliant! Yes, I am using the GridBagLayout...it would have taken me days to figure this out and a lot of frustration. Thanks for the many options to resolve my issue.

THANK YOU, Hari!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!