This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Force Scrool on JTextPane? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Force Scrool on JTextPane?" Watch "Force Scrool on JTextPane?" New topic

Force Scrool on JTextPane?

Jimmy Nilsson

Joined: Sep 25, 2004
Posts: 26

I have a JTextPane that i have added som text in, this text is to the left, by this i dont get the horizontal scrollbara available.

I am drawing some drwaings in this JTextPane and need to be abled to scrool horizontal to see all the drawings.

How do i do this? i know that JPane have a prefersize witch works fine, but JTextPane does not respond on this method?

How do i solve this?

Joe Ess

Joined: Oct 29, 2001
Posts: 8836

JTextPane does not have scrollbars. You have to use a JScrollPane.

"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Jimmy Nilsson

Joined: Sep 25, 2004
Posts: 26
Yes i use JScrollbars, exacly as i do to the JPane, but in the jpane i can set the preferedsize and the horizontal jscoolbar will be activated, this does not wokr in JTextPane.

I have tryed before to set values to the JScroolbar but this wount work, maby you could show me?

As i said, i can get the vertical scroolbars active by adding text but to activet the hrozontal whene there is no text simes hard?

I agree. Here's the link:
subject: Force Scrool on JTextPane?
Similar Threads
Make it abled to scrool Horizontal
Large Tekst input field with scrool bar
How to retrieve an icon from JTextPane ??
automatic scrool to the Textarea
Remove Horizontal Scrool bar in Mozilla Firefox browser?