• 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
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

relayouting after setViewportView for JScrollPane

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have 2 JTextArea objects which I'm setting to same JScrollPane, the problem is that one object have bigger text than other and has Vertical Scrollbar, both JTextArea objects have word wrap enabled so they should not have Horizontal Scroll Bar, but when I move from JTextArea with no Vertical Scrollbar, to JTextArea with it, the resulting object is slightly bigger and a Horizontal Scrollbar appears.
Is there a way to call some kind of layout so that size will be evaluated each time ViewportView is set (or after it is set)?
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Sergio Baca:
I have 2 JTextArea objects which I'm setting to same JScrollPane, the problem is that one object have bigger text than other and has Vertical Scrollbar, both JTextArea objects have word wrap enabled so they should not have Horizontal Scroll Bar, but when I move from JTextArea with no Vertical Scrollbar, to JTextArea with it, the resulting object is slightly bigger and a Horizontal Scrollbar appears.
Is there a way to call some kind of layout so that size will be evaluated each time ViewportView is set (or after it is set)?


Can you please clarify your problem? I have some experience with java text elements and may be I can help. Why don't you change text in JTextArea but change text elements in JScrollPane?
 
Sergio Baca
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Laba Jolly:

Can you please clarify your problem? I have some experience with java text elements and may be I can help. Why don't you change text in JTextArea but change text elements in JScrollPane?


I simplified my problem, here is the code:

When I enlarge window, it automatically relayout text, but when I shrink it back, instead of relayout a horizontal scrollbar is appearing.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic