Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The <code>applet</code> tag should be:</p> <pre><code>&lt;applet code=testing.class width="300" height="300" /&gt; </code></pre> <p>Notice the change in the <code>code</code> attribute. Compare to the example code listed in the <a href="http://docs.oracle.com/javase/7/docs/technotes/guides/plugin/developer_guide/using_tags.html#applet" rel="nofollow noreferrer">relevant Java Tutorial</a>:</p> <pre><code>&lt;applet code=Applet1.class width="200" height="200"&gt; Your browser does not support the &lt;code&gt;applet&lt;/code&gt; tag. &lt;/applet&gt; </code></pre> <p>The following is working for me.</p> <p><a href="http://puu.sh/PebS" rel="nofollow noreferrer">http://puu.sh/PebS</a></p> <h1>TestingApplet.java</h1> <pre><code>import java.applet.Applet; import java.awt.Color; import java.awt.Graphics; public final class TestingApplet extends Applet { public void paint(final Graphics g){ g.drawOval(0, 0, 250, 100); g.setColor(Color.RED); g.drawString("My Applet", 10, 50); } } </code></pre> <h1>testing-applet.html</h1> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;Applet&lt;/title&gt; &lt;/head&gt; &lt;body&gt; Program &lt;br /&gt; &lt;applet code=TestingApplet.class width="300" height="300" /&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>If this is not working, I have two questions for you...</p> <ul> <li><p>Did you save the Java as a <code>.java</code> file and compile it to produce the correct <code>.class</code> file?</p></li> <li><p>Did you verify your browser is not caching an old incorrect version of the <code>.html</code> file?</p></li> <li><p>Are your <code>.class</code> and <code>.html</code> files in the same directory?</p></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload