Highlighing Text in non-Focussed Containers

  • Thread starter Mike Westerfield
  • Start date
M

Mike Westerfield

I have a JTextPane (actually, two of them) with text selected. I would
like for the selection to show up even when the JTextPane does not
have the focus, but the highlight vanishes when the focus is lost.

Short of writing a new Highlighter and replacing the default one, is
there any way to accomplish this?

If writing a new Highlighter is the best way to accomplish this, I
suspect there must be a few laying around. Does anyone have a URL for
such a class?

Thanks,

Mike Westerfield
 
K

Kleopatra

Mike said:
I have a JTextPane (actually, two of them) with text selected. I would
like for the selection to show up even when the JTextPane does not
have the focus, but the highlight vanishes when the focus is lost.

Short of writing a new Highlighter and replacing the default one, is
there any way to accomplish this?

hiding the selection highlighter is done in DefaultCaret - so the
solution is to use a custom caret that doesn't.

Greetings
Jeanette
 

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

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top