changing part of the background of a jTextPane

P

Peter Wieser

I want to change the backgroundcolor for a few lines in a jtextpane. I do
not want to change it like

MutableAttributeSet hilight=new SimpleAttributeSet();
StyleConstants.setBackground(hilight,new Color(230,230,180));
styledDoc.setCharacterAttributes(anf,end-anf,hilight,false);

because when I do so, only the characters change their background; but I
want that the new
background has a rectangle shape. So my Problem is the following: I have the
indices of the
first and last character in the jtextpane and want, that this area has a new
rectangular backround
color. I guess I have to do something with fillRect on the jTextPane, right?
But how???
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,444
Messages
2,571,709
Members
48,796
Latest member
Greg L.
Top