1 Reply Latest reply on Sep 3, 2012 10:55 AM by StanislavL

    JEditorPane linewrap


      I'm using a JEditorPane in a BorderLayout, the JEditorPane is in the center.
      This way I don't need a preferred size for the JEditorPane.
      But when I put in a lot of text, the JEditorPane doesn't wrap the text, only when I use a preferred size.
      But with the preferred size the text is cut of at the bottom when it gets to long.

      So my question: is there a way to activate line/ word wrap on an JEditorPane with no fixed size?
      Some help please.
        • 1. Re: JEditorPane linewrap
          Check this to understand how wrap works

          You can override get preferred size to return fixed width but any height.
          http://java-sl.com/tip_text_height_measuring.html this one hoiw to measure content.

          I think the simplest way is to place the JEditorPane in a JScrollPane without scroll bars.
          1 person found this helpful