Skip to main content

How to bring back highlighting selection to JXLabel?

Please note these forums are being decommissioned and use the new and improved forums at
1 reply [Last post]
Joined: 2010-08-30

Hi everyone,

I have a scenario where I need a label that can wrap multi-line text, with text alignment support, so I'm glad JXLabel has it all!

However, I also need to give the ability to select my label to allow copying the text (although I know this is not usually done with label components, but I really have to use a JXLabel here).

The documentation above JXLabel.MultiLineSupport mentions that "All other classes here, when their name matches corresponding class from swing.text.* package are copy of the class with removed support for highlighting selection." so I would like to know whether is it fairly possible for me to revert that change. I am trying to find a solution myself but I'll be more than happy if someone can put me on the right track, specially authors of JXLabel! :-)

Thanks a lot,

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2006-06-08

Firstly that's an implementation detail that was made public.  We could choose to use a completely different mechanism for multi-line support.

Secondly label don't support highlighting; that's not their purpose.

Given that we wouldn't "bring back support" for something that was never there and never intended to be there.