What's wrong with this code? It works in NetBeans. I've tried to open it in browser, but there is Null Pointer Exception error, probably because of image (without graphic it works).
public class Sth extends JApplet {
private Image img;
@Override
public void init() {
img = getImage(getCodeBase(), "logo.png");
setSize(200,200);
JPanel panel = new JPanel();
panel.setLayout(null);
add(panel);
JLabel cos = new JLabel();
cos.setIcon(new ImageIcon(img));
cos.setBounds(20,20,100,100);
panel.add(cos);
}}