[nbusers] How to enabled wrapping in JTextPane

  • From: "kcaz" < >
  • To:
  • Subject: [nbusers] How to enabled wrapping in JTextPane
  • Date: Sat, 01 Dec 2012 15:48:50 -0500

Hi, I have a question more about Java and Swing, but since I use the Netbeans 
Swing editor to generate my Swing code, I figure I would ask here.

I have  JTextPane inside a JScrollPane, and the way wrapping works is a 
little weird. Basically I want something like in Word: when you add text if 
it is too long it wraps at the next word. I know this is the default function 
of a JTextPane. When there isn't a word break, however, the JTextPane doesn't 
break the word in the middle of the word, but instead increases the size of 
the text pane (I think) to accommodate the larger word. This because the 
JTextPane is now bigger, any other text that I added earlier to the textpane 
which had previously word wrapped now extends to the new boundary of the 
textpane, and then wraps there. 

How can I make it so that if the word is too big for the textpane, instead of 
extending the textpane it cuts the word and puts the rest of the word on the 
next line?

[nbusers] How to enabled wrapping in JTextPane

kcaz 12/01/2012

[nbusers] How to enable wrapping in JTextPane

kcaz 12/02/2012

[nbusers] Re: How to enabled wrapping in JTextPane

Ion Iovu 12/03/2012

[nbusers] How to enable wrapping in JTextPane

kcaz 12/03/2012

Project Features

About this Project

www was started in November 2009, is owned by jpirek, and has 25 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20150226.965aeb8). © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
Please Confirm