• Post Reply Bookmark Topic Watch Topic
  • New Topic

JTextPane/line spacing.  RSS feed

 
nivedita rajiv
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Friends,
I like to have a help from u people.
I have a content such as
<html><body>This is first line<br>This is second line</body></html>
I set the text to JTextPane.In which i need is the distance between the first & second line should be set by explicitly by me.
For eg:The output wuld be like this
This is first line.
This is second line.
Will i be able to set the distance between 2 lines in JTextPane if so how could it be possible.
Excepting u'r reply,
Thanks & Regards,
Nivi.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check out this article on O'Reilly's website... look in the paragraph about "Paragraph and Character Styles"... the method you are looking for is StyleConstants.setLineSpacing( MutableAttributeSet a, float i ); and this article shows an example of how to use it.
 
nivedita rajiv
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Nate,
Thanks for u'r response.I was just happy to see u'r response.This is what i needed from u'r reply.I went thro' the link u gave & also did a sample application & also did the downloaded that source & runned but all reflects except the setLineSpacing alone doesn't work which is very much I'm needed. Culd u pl.. help me out in this regard.
Eagerly excepting u'r reply.Pl help me out in this regard such that setline spacing works out in jtextpane.
I wuld explain y i need this.Ihave a jtextpane in which i ahve contents the line spacing for jdk1.4 version is less but for jdk 1.3 its more than jdk1.4 which makes my content out of jtextpane but which culd be accomodated in jtextpane in jdk1.4 version.
Pl.. help me out in this regard.
Regards,
Nivi.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!