Hey!
I have two JPanel with JScrollPanes, i am overriding the paint mothod on this JPanel and then i takes the Graphics obj and paint out text and lines on the JPanel. After the page is finish i set the setPreferredSize so i can scroll to see the howl dokument.
The text is saved in one
string and the color is saved in one string
TextStr = "Hey is this right?"
MarkStr = "000011000000444442"
And to fasten this upp so i dont have to go throw char by char i only do this the first time. This first time im saving down the paint areas in an array with its position(where on the screan it will be printed).
In this case it is
Array[0] = "Hey "
Array[1] = "is"
Array[2] = " this "
Array[3] = "right"
Array[4] = "?"
And in the second time i am int the pint method i am just paiting all that the array have. So i dont have
alot of loops that checks every char and what color it would have to be.
This inproves the preformance when scrolling in the dokument, but not as good as i hade hope.
the strange thing is that i have tryed to skip the drawing to the pane the second time, and it lookt like the JScroolPane is taken care of this, so i dont have to go to this array every time it have to be redrawn.
Now i need it to be even faster.
Do you have any
ide how i could fasten this up? i realy need it to paint faster, its still lagging on my machin, and it will lagg alot mor on the system it will be runned leter on.
Maby it helps to just JTextPane ?? it have not problems to draw the lines and so on, but it simes like the Text is taking alot of preformance.
I have tryed to use JTextPane but then the JScrollPane will not work at all?
Best Regards
Jimmy