aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes relayouting after setViewportView for JScrollPane Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "relayouting after setViewportView for JScrollPane" Watch "relayouting after setViewportView for JScrollPane" New topic
Author

relayouting after setViewportView for JScrollPane

Sergio Baca
Greenhorn

Joined: Sep 30, 2001
Posts: 21
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)?


Free open source onscreen <a href="http://jslope.com/ruler.htm" target="_blank" rel="nofollow">Ruler</a>
Laba Jolly
Greenhorn

Joined: Nov 17, 2003
Posts: 1
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

Joined: Sep 30, 2001
Posts: 21
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: relayouting after setViewportView for JScrollPane
 
Similar Threads
Very Different Problem with JScrollPane
JTextArea
Scrolling in a JScrollPane problem
problem with spacing of text in JTextArea
add a JTextPane to a JScrollPane