java - How Do I Set An Icon For JLabel -


I want to set an icon for a JLLL, someone can give me the syntax example

I have tried this:

  jlab icon = new jlab (); Image Icon chromo = createImageIcon ("res / icon.png"); Panel.add (icon); Icon.setIcon (sun); After that, I tried that the label was not visible at all on the panel.   

  jlab icon = new jlab (); Image Icon chromo = createImageIcon ("res / icon.png"); Icon.setIcon (sun); Panel.add (icon);  

And do not forget to check your layout .... if its full you need to add boundaries

  icon.setBounds (startX, StartY, width, height);  

Comments

Popular posts from this blog

c# - SignalR: "Protocol error: Unknown transport." when navigating to hub -

class - Kivy: how to instantiate a dynamic classes in python -

python - mayavi mapping a discrete colorbar on a surface -