aspose file tools*
The moose likes Java in General and the fly likes Setting the width of a JTextPane Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Setting the width of a JTextPane" Watch "Setting the width of a JTextPane" New topic
Author

Setting the width of a JTextPane

Frederick Winsnes
Greenhorn

Joined: Feb 22, 2011
Posts: 17

Hello
I want to use a JTextPane in which the user should write whatever they want

I would like to have a limited width but an unlimited height on the JTextPane but I can't find a way to do that, so now I am asking:
is there a way to set the width of a JTextPane, inside a layout?

I am using a BorderLayout in the JFrame in which the JTextPane is located.

Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2090
    
    7
Add the JTextPane to a JScrollPane. The text will wrap automatically when the width of the text pane is reached.

If you need more help then post your SSCCE that demonstrates the problem.
Frederick Winsnes
Greenhorn

Joined: Feb 22, 2011
Posts: 17

Rob Camick wrote:Add the JTextPane to a JScrollPane. The text will wrap automatically when the width of the text pane is reached.

If you need more help then post your SSCCE that demonstrates the problem.


Just what I needed!
Thank you very much
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Setting the width of a JTextPane
 
Similar Threads
Displaying all of the text in a JTextPane How???
determine with
JTable with TextRenderes as TextPane
JTextPane viewable area
viewports and scrollbars