I found out that when I use the Terminal to compile the .java source code and run that with a simple html file, it works in the applet viewer and in the browser. So that means, the problem is definietly with NetBeans.
Any fellow NetBeans users ever encounter the same problem?
This issue is still unresolved because I'd like to be able to run my applets directly from NetBeans if possible!
Here is the code:
SalutonApplet.java:
Code:
import java.awt.*;
public class SalutonApplet extends javax.swing.JApplet {
String greeting;
//GridBagLayout grid = new GridBagLayout();
public void init() {
//this.setLayout(grid);
greeting = "Saluton mondo!";
}
public void paint(Graphics screen) {
Graphics2D screen2D = (Graphics2D) screen;
screen2D.drawString(greeting, 25, 50);
}
}
SalutonApplet.html:
Code:
<HTML>
<BODY>
<APPLET CODE=SalutonApplet.class WIDTH=200 HEIGHT=100>
</APPLET>
</BODY>
</HTML>