Tuesday, 20 August 2013

How to fix Initialize applet error

How to fix Initialize applet error

Your help is much appreciated. Can anyone tell me (using code) why when I
run this program (that is supposed to display my image) tells me: Start:
applet not initialized.
In the console box, I get this error:
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
HERE IS MY CODE-----
import javax.swing.*;
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.util.Scanner;
public class Memory extends JPanel {
ImageIcon dots = new ImageIcon("Dots1.jpg");
private JLabel Hi = new JLabel("Hi");
//ImageIcon Dots = new ImageIcon(this.getClass().getResource("Dots.jpg"));
Memory(){
new ImageIcon(getClass().getResource("/resources/Dots1.jpg")).getImage();
Hi.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/resources/jpg/Dots1.jpg")));
Hi.setPreferredSize(new Dimension(100,100));
this.add(Hi);
}
}

No comments:

Post a Comment