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

python - Strange behavior using PyQt4's 'pyqtSlot' decorator before another decorator -

c# - UnhandledExceptionMode.ThrowException for AppDomain.UnhandledException -

c# - Process.Kill() returns access denied -