• 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 ...
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

How to make JEditorPane scrollable?

Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

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!
Posts: 3648
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic