Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Get the text marking right in JTextPane?  RSS feed

 
Jimmy Nilsson
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey!

I Creates a Styled document, and marks some words. Every line is ended with a \n.

To add my text to the styleddocument i use
Styleddocument.insertString(this.getLength(), " " + pt.getStr(),
this.getStyle("" + pt.getCol()));

The a add this Styled dokument to the JTextPane by
MyJTextPane.setStyledDocument(Styleddoc);

There will be colors, but the problem is that it is not coloring all the way out on the right side? and if i mark the text by drag the mouse pointer over and puch the button to select som text it will be selected, but that part of the text on the right side that was not colored is not visible at all?

Maby not to god explanation, but plesa try to help me on this one, this is my 3d try to display text repetly.

//SnowJim
 
Jimmy Nilsson
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A note: this problem only accure on Solaris, in Windows it works fine.

//SnowJim
 
javainthinking
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just do it yourself?^_※!
 
Jimmy Nilsson
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey!

I have tryed to print out the text manual as you say by using Graphics.drawString(TEXT)

But this takes alot of preformance, the JText Pane most have some special algorithms to show the text, problely not .drawString (or .drawtext?)

or is there anything i am missing?

I have also tryed to draw the content to a bitmap file and then show this bitmap file, but then i have to devide the pages so i dont get BIG bitmaps.

Pleas any sugestions at all?

//Jimmy
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!