• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Applet Problem

 
Krishna Priya
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can some one help me with my applet.
I am getting a null pointer exception in the console.
My app runs fine as an application but, does not run as an applet.
Please let me know what I am doing wrong.
Here is my Applet code.

public class TutorInterface extends JApplet {
public TutorInterface() {
super();
initComponents();
setSize(300, 320);
}
private void initComponents() {
table1 = new pact.DorminWidgets.DorminTable();
jLabel1 = new javax.swing.JLabel();
setLayout(null);
table1.setColumns(6);
this.add(table1);
table1.setBounds(50, 30, 230, 140);
jLabel1.setFont(new java.awt.Font("MS Sans Serif", 1, 24));
jLabel1.setText("+");
this.add(jLabel1);
jLabel1.setBounds(30, 100, 20, 30);
}
private static void createGUI() {
JFrame.setDefaultLookAndFeelDecorated(true);
JFrame frame = new JFrame("Student Interface");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(new TutorInterface());
frame.setSize(300,300);
frame.setVisible(true);
}
public void init() {
try {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createGUI();
}
});
} catch (Exception e) {
System.err.println("createGUI didn't successfully complete");
}
}
}

Here is my HTML

<HTML>
<HEAD>
<TITLE> Tabel Widget </TITLE>
</HEAD>
<BODY>
Here is the output of my program:
<APPLET CODE="TutorInterface.class" WIDTH=300 HEIGHT=300>
</APPLET>
</BODY>
</HTML>
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In which line does the exception happen?

(In the future, please us a more descriptive subject. In the applet forum, a subject like "Applet Problem" does not convey anything about the problem.)
 
Krishna Priya
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, I have the Html and the TutorInterface.class file in the same directory. but when I invoke the HTML it says that it cannot find the class.
TutorInterface (wrong name: AdditionTutorNoChaining/TutorInterface)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic