0

When I view my Applet using AppletViewer, it looks fine. However, when I try to run it in Safari, it doesn't show up. Same problem with Chrome, Firefox, and Opera.

Here's my Java code:

import java.awt.*;
import javax.swing.JApplet;

public class WelcomeApplet extends JApplet
{
    public void paint(Graphics g)
    {
        super.paint(g);
        //setSize(500, 190);

        g.setColor(Color.red);
        g.drawString("Welcome to Java applet programming!", 30, 30);

        g.setFont(new Font("Courier", Font.BOLD, 24));
        g.drawString("Courier bold 24pt font", 30, 36);

        g.setFont(new Font("Arial", Font.PLAIN, 30));
        g.drawString("Arial plain 30pt font", 30, 70);

        g.setFont(new Font("Dialog", Font.BOLD + Font.ITALIC, 36));
        g.drawString("Dialog italic bold 36pt font", 30, 110);

        g.setFont(new Font("Serif", Font.ITALIC, 42));
        g.drawString("Serif italic 42pt font", 30, 156);
    }
}

And here's my HTML:

<HTML>
    <HEAD>
        <TITLE>Welcome Applet</TITLE>
    </HEAD>
    <BODY>
        <OBJECT CODE="WelcomeApplet.class" WIDTH="440" HEIGHT="50">
        </OBJECT>
    </BODY>
</HTML>

Everything compiles fine. All of my files are in the same directory on my computer. There's nothing showing up in the Java console.

Thanks for any help!

EDIT: Suggested question does not address problem

kgrimes2
  • 136
  • 3
  • 12
  • Possible duplicate of [Java applet does not display anything](http://stackoverflow.com/questions/14347590/java-applet-does-not-display-anything) – Maheshwar Ligade Dec 02 '15 at 04:50
  • Are you sure that the browser is not blocking it? In special, due to some shady disputes and policies, Chrome won't run applets anymore. Firefox however, should run it just fine once the lastest version of the Java plugin is installed and unblocked. – Victor Stafusa - BozoNaCadeia Dec 02 '15 at 04:51
  • I've run other applets on Safari, and they work fine. I don't know why my browser would be blocking this particular one. I tried using Firefox, but it still doesn't show anything. – kgrimes2 Dec 02 '15 at 04:54
  • There's a reason why I hate applets. Chrome right out refuses to run them, IE and Firefox won't run it because the applet is not signed. – MadProgrammer Dec 02 '15 at 05:03
  • Once I add the `file://{path to html}` to my "Exception Site List" in the Java Control Panel, the applet loads and runs (at least in FireFox) – MadProgrammer Dec 02 '15 at 05:07
  • MadProgrammer, just to clarify, you put `file:///Users/myUser/.../WelcomeApplet.html`, right? I'm not missing anything? Because that's what I put and I'm still getting nada. – kgrimes2 Dec 02 '15 at 05:16

0 Answers0