Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scrollable html JLabel

I have a Jlabel packed with html. I would like to scroll this content as you would with overflow : auto; in css. I can't seem to get this to work. Has anyone come across this? I'd like to keep the content in HTML - for mark up - and use something light to scroll though it.

BTW: The Jlabel is in a popup - I can use something else other than a JLabel if needs be but would like to keep the html.

Cheers,

slotishtype

like image 208
slotishtype Avatar asked Sep 08 '26 02:09

slotishtype


1 Answers

Put that JLabel in a JScrollPane instanciated that way :

JScrollPane scroller = new JScrollPane(myJLabel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);

Notice that, as this constructor states, those parameters can be changed afterwards.

like image 58
Riduidel Avatar answered Sep 10 '26 18:09

Riduidel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!