View Single Post
Old 06-03-2011, 12:31 AM   PM User | #2
2B67
New to the CF scene

 
Join Date: Apr 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
2B67 is an unknown quantity at this point
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>
2B67 is offline   Reply With Quote