Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to make JEditorPane scrollable?  RSS feed

 
Hermann Maie
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear CodeRanch Members,

I am currently developing a swing application and I implemented a tabbed pane with two tabs. Each of the tabs should shows a external html file. Additionally, I implemented a JScrollPane because html files don' fit to preferred size of the swing gui. So far, so good. My problem is that the scrollbar is showing, but it isn't scrollable.

I attached a extract of my code and uploaded a screenshot of my swing gui.
http://www3.pic-upload.de/11.07.09/4tdql13awi9.png



I hope you can help me figuring out why the JEditorPane's don't scroll, although the size of html files are far bigger.

Thanks in advance!
 
K. Tsang
Bartender
Posts: 3632
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are using JScrollPane and your JEditorPane is in the JScrollPane like this:

Then it should work. Try using another html file that on its own needs scrolling. Because if the html content fits in the JEditorPane with no scroll bars means the content really doesn't need scroll bars. Also say the html content is a table and the width is say set to 100% then I don't think the horizontal bars will show because it will fit the width of the JEditorPane. Yet if you use pixel for width then the h bars will show. So try changing the html content.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!