show my java applet in HTML [closed]
I'm having a trouble embedding my applet in my HTML code the error that appear to me myapplet.class not found in fact that myapplet.class on the same file of the HTML page.can any one figure the problem? here is my applet code
package applet;
import java.awt.TextArea;
import javax.swing.JApplet;
/**
*
* @author Islam
*/
public class myapplet extends JApplet {
/**
* Initialization method that will be called after the applet is loaded
* into the browser.
*/
TextArea tx;
public void init() {
// TODO start asynchronous download of heavy resources
tx=new TextArea();
tx.setSize(100, 200);
add(tx);
}
// TODO overwrite start(), stop() and destroy() methods
}
and here is my html code
<html>
<div class="qtext">
<?php echo $questiontext; ?>
</div>
<div class="ablock clearfix">
<div class="prompt">
<?php echo $stranswer; ?>
</div>
<h1>Islam Nosser</h1>
<applet ALIGN="CENTER" CODE="myapplet.class" WIDTH="800" HEIGHT="500"></applet>
<br />
<?php if ($feedback) { ?>
<div cla开发者_开发知识库ss="feedback">
<?php echo $feedback; ?>
</div>
<?php } ?>
<?php $this->print_question_submit_buttons($question, $state, $cmoptions, $options); ?>
</div>
</html>
but still the applet doesn't appear and with [that alarm myapplet.class not found
myapplet.class not found
That's pretty self explaining. That file cannot be found. Let's look how you declared the applet.
<applet code="myapplet.class" ...>
So, it expects that the class file doesn't have a package
declaration and that it is in the same folder as the PHP file containing that HTML code line. Fix it accordingly.
精彩评论