www.webdeveloper.com
Results 1 to 3 of 3

Thread: Steps to execute Applets

  1. #1
    Join Date
    Nov 2006
    Posts
    14

    Question Steps to execute Applets

    Can anyone tell me how can I excute applets using the web??

  2. #2
    Join Date
    Nov 2006
    Posts
    14


    Can anyone tell me what's wrong with my code.. It doesnt work??
    <html>
    <head>
    </head>
    <body bgcolor="000000">
    <center>
    <applet
    code = "Einstein.class"
    width = "500"
    height = "300"
    >


    import javax.swing.JApplet;
    import java.awt.*;
    public class Text1 extends JApplet
    {

    public void Paint (Graphics Page)
    {
    final int MID =150;
    final int TOP =50;

    setBackground (Color.cyan);

    Page.setColor (Color.blue);
    Page.fillRect (0, 175, 300, 50);

    Page.setColor(Color.yellow);
    Page.fillOval(-40, -40, 80, 80);

    Page.setColor(Color.white);
    Page.fillOval(MID-20, TOP, 40, 40);
    Page.fillOval(MID-35, TOP+35, 70, 50);
    Page.fillOval(MID-50, TOP+80, 100, 60);

    Page.setColor(Color.black);
    Page.fillOval(MID-10, TOP+10, 5, 5);
    Page.fillOval(MID+5, TOP+10, 5, 5);

    Page.drawArc(MID-10, TOP+20, 20, 10, 190, 160);
    Page.drawLine(MID-25, TOP+60, MID-50, TOP+40);

    Page.drawLine(MID-20, TOP+5, MID+20, TOP+5);
    Page.fillRect(MID-15, TOP-20, 30, 25);

    }
    }



    </applet>
    </center>
    </body>
    </html>

  3. #3
    Join Date
    Nov 2003
    Location
    Worthington, OH, USA
    Posts
    3,634
    This code goes in your web page (note that applet has been depreciated in favor of object):
    Code:
     <html>
    <head>
    </head>
    <body bgcolor="000000">
    <center>
    <applet code = "Einstein.class" width = "500" height = "300" >
     </applet>
    </center>
    </body>
    </html>
    This code goes into a file called Einstein.java and is "compiled" using the JAVA compiler to create Einstein.class
    Code:
    import javax.swing.JApplet;
    import java.awt.*;
    public class Text1 extends JApplet
    {
    
    public void Paint (Graphics Page)
    {
    final int MID =150;
    final int TOP =50;
    
    setBackground (Color.cyan);
    
    Page.setColor (Color.blue);
    Page.fillRect (0, 175, 300, 50);
    
    Page.setColor(Color.yellow);
    Page.fillOval(-40, -40, 80, 80);
    
    Page.setColor(Color.white);
    Page.fillOval(MID-20, TOP, 40, 40);
    Page.fillOval(MID-35, TOP+35, 70, 50);
    Page.fillOval(MID-50, TOP+80, 100, 60);
    
    Page.setColor(Color.black);
    Page.fillOval(MID-10, TOP+10, 5, 5);
    Page.fillOval(MID+5, TOP+10, 5, 5);
    
    Page.drawArc(MID-10, TOP+20, 20, 10, 190, 160);
    Page.drawLine(MID-25, TOP+60, MID-50, TOP+40);
    
    Page.drawLine(MID-20, TOP+5, MID+20, TOP+5);
    Page.fillRect(MID-15, TOP-20, 30, 25);
    
    }
    }
    54 68 65 42 65 61 72 4D 61 79

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles