• Post Reply Bookmark Topic Watch Topic
  • New Topic

preventing line wrap in jTextPane  RSS feed

 
Premila
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
in my application, while the user types in JTextPane, i
require that there should not be line wrapping and whatever the user types goes in a single line like a JTextFiled.
how can this be achieved.
thanks in advance,
premila
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Premila,

Use a JTextArea instead of a JTextPane and use the setLineWrap( false ) call to affect this.

Also, please read the JavaRanch username policy and re-register with a user name meeting the criteria ( i.e. in the format "first name" + space + "last name" ).

Thanks,
-Nathan
 
Premila
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

hi nathan,
actually i want it(control line wrapping) for only jTextPane cos i need to
do some formating with the texts (like each character represented with different color). this formatting is not possible with JTextArea. so i want to restrict line
wrapping for jTextPane.
regards
premila

Originally posted by Nathan Pruett:
Premila,

Use a JTextArea instead of a JTextPane and use the setLineWrap( false ) call to affect this.

Also, please read the JavaRanch username policy and re-register with a user name meeting the criteria ( i.e. in the format "first name" + space + "last name" ).

Thanks,
-Nathan


[This message has been edited by Premila (edited November 20, 2001).]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!