Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JTextPane

 
Koen Follong
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 255
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Koen Follong
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic