Selectable JLabel, without just a JTextfield
-
24-05-2021 - |
Question
I need to be able to select the text in a JLabel. Ive read some guides on the net that talk about using a JTextfield to simulate a JLabel, however this is no use to me as I my JLabel will span multiple lines. So any ideas on how to do this or if it's even possible?
Solution
You can use a non-editable JTextArea
which allows for multiple lines and selectable text, and visually looks the same as a JLabel
.
I do not think it is possible with a JLabel
(at least I do not know how)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow