• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

resize window distorts view

 
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 201
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic