M
M
mlwrm2016-02-29 22:12:36
Java
mlwrm, 2016-02-29 22:12:36

How to embed applet in html in IDEA?

Hello, there is an html file in the /helloworld folder

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>MyTittle</title>
</head>
<body>
    <object code="HelloWorld.class" width=300 height=250/>
</body>
</html>

/helloworld/src has a HelloWorld class
import javax.swing.*;
import java.awt.*;

public class HelloWorld extends JApplet {
    public void paint(Graphics g){
        g.drawString("Hello World", 50, 100);
    }
}

When I open the html file in the browser, nothing is displayed.
Where is the mistake?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Kornachev, 2016-02-29
@malworm

<applet code="HelloWorld" width=300 height=250/>
I don't remember exactly.
Applets are dead, no one uses them, and almost all browsers have officially abandoned support for the corresponding plugins.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question