Frage

I know it's possible to use HTML but what if you are loading the icon image from a package instead of a directory?

How would you go about adding icon to a jcheckbox's label?

http://www.exampledepot.com/egs/javax.swing/checkbox_AddIcon.html

War es hilfreich?

Lösung

add Icon and String to the JLabel, then set JLabel#setLabelFor(myJCheckBox)

Andere Tipps

I show various ways in my answer to "Loading images from jars for Swing HTML". But using an explicit URL (obtained from Class.getResource(String)) should work just fine as the src attribute of the img element.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top