LMSouq
moodle-core Open

Add Java applet to my new question type in Moodle?

IS
islam
1 month ago
3 views
Problem Description
I'm trying to add a Java applet to my display.html for my new question type. But unfortunately an error appears, that *myapplet.class not found*. In fact it is on the same folder with display.html and when I run the display.html alone the applet appears, only it doesn't appear when I run the question type inside Moodle. Here is the code for the 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 the code of the display.html <html> <div class="qtext"> <?php echo $questiontext; ?> </div> <div class="ablock clearfix"> <div class="prompt"> <?php echo $stranswer; ?> </div> <table class="answer"><tr><td><?php // HTML editors have to go in tables. ?> <?php echo $answer; ?> </td></tr></table> <applet code=myapplet.class name=myapplet archive=applet.jar width=1000 height=500>Your browser is not Java enabled.</applet> <param name="bgcolor" value="ffffff"> <param name="fontcolor" value="000000"> Your browser is not Java enabled. </applet> <br /> <?php if ($feedback) { ?> <div class="feedback"> <?php echo $feedback; ?> </div> <?php } ?> <?php $this->print_question_submit_buttons($question, $state, $cmoptions, $options); ?> </div> </html>

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base