aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes JTextPane Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTextPane" Watch "JTextPane" New topic
Author

JTextPane

Koen Follong
Greenhorn

Joined: Mar 26, 2001
Posts: 2
Hi,
I'm wondering if you can limit the number of rows a user can add in a JTextPane. I'm using a JTextPane (instead of a JTextField) because I want to format my text (bold, italic, underline, ...).
Anyone an idea ?!
Tnx!
Koen
Matt Senecal
Ranch Hand

Joined: Dec 01, 2000
Posts: 255
You may want to create a custom StyledDocument for the JTextPane. I've used Documents in the past to set things like maximum number of characters and rows.


There's nothing more dangerous than a resourceful idiot. ---Dilbert
Koen Follong
Greenhorn

Joined: Mar 26, 2001
Posts: 2
Hi,
yes it works like that ...
I just overwrite the insertString of my document on my JTextPane and filter out the <enter>s ...
Tnx!
Koen
 
 
subject: JTextPane