• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why does this JTextPane cause JScrollPane to flicker when I type into it?

 
Gerald Lampi
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following code example causes the vertical scrollbar to appear and disappear as you type into the JTextPane.

Any ideas on how to fix it?

Screencast of the flicker issue.

 
Rob Camick
Ranch Hand
Posts: 2476
8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First of all it works OK with a JTextArea.

Why the difference? I'm just guessing.

In both cases the text components have a variable preferred size. As characters are added/removed the preferred size changes and the component is revalidated.

For a text pane the text wraps automatically (when needed), for the text area it doesn't.

Maybe the text pane has a problem thinking it needs to wrap the text but then realizes it doesn't so the scrollbar flashes.
 
Darryl Burke
Bartender
Posts: 5116
11
Java Netbeans IDE Opera
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gerald, we don't have too many rules here, but we do ask that you BeForthrightWhenCrossPostingToOtherSites

http://forums.oracle.com/forums/thread.jspa?threadID=2264353
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic