• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

JScrollPane Weight Shift In GridBagLayout

 
Ranch Hand
Posts: 191
Netbeans IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The problem with this layout has to do with the JScrollPane which is on the third (cell 5) last cell in the grid. When text is appended to the JTextArea within the JScrollPane, the weight of the JScrollPane expands, thus pushing downward the two items in the last two cells. The lowermost cell is a JLabel for status messages. When text is removed from the JTextArea, the JScrollPane once again changes size, and the the components below move upward to fill the space. I am trying to find a way to the keep the lower half of the layout from shifting regardless of how much text is appended to the JTextArea. I have tried setting the JScrollPane with the constant JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, but it makes no difference.

 
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To increase your chances of getting help you should create a SSCCE, that demonstrates the incorrect behaviour.
 
Ranch Hand
Posts: 650
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Look at your gridweighty when adding this.clear, bottom and this.status
 
Isaac Hewitt
Ranch Hand
Posts: 191
Netbeans IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok Mark, I took your advice and configured the following 2 items as you see below adding the weighty configuration. The JSrollPane no longer resizes when text is appended or removed. Thanks for your advice.

 
reply
    Bookmark Topic Watch Topic
  • New Topic