Showing posts with label Applet. Show all posts
Showing posts with label Applet. Show all posts

Thursday, 6 December 2012

Running face using java applet

Java applet program to implementing running face

import java.awt.*;
import java.applet.*;

/*
    <Applet    code="runFace"
        height=500
        width=500
    >
    </Applet>
*/

public class runFace extends Applet implements Runnable
{
    int h1,h2,h3,h4;
    int ley1,ley2,ley3,ley4;
    int rey1,rey2,rey3,rey4;
    int leyld1,leyld2,leyld3,leyld4;
    int reyld1,reyld2,reyld3,reyld4;
    int ns1,ns2,ns3,ns4;
    int mt1,mt2,mt3,mt4;
    int flag;
   
    public void init()
    {
        h1=40;h2=40;h3=150;h4=150;
        ley1=70;ley2=70;ley3=30;ley4=20;
        rey1=120;rey2=70;rey3=30;rey4=20;
        reyld1=125;reyld2=65;reyld3=150;reyld4=65;
        leyld1=70;leyld2=65;leyld3=95;leyld4=65;
        mt1=90;mt2=140;mt3=50;mt4=10;
        ns1=112;ns2=90;ns3=112;ns4=125;
        setBackground(Color.cyan);
    }
    public void start()
    {   

Tuesday, 30 October 2012

Digital clock java applet program

This is a java program to display Digital clock in an applet

import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.util.*;
/*
    <applet code="DigiClock"
        width=400
        height=300
    >
    </applet>
*/
public class DigiClock extends Applet implements Runnable
{
       public Date d;
       Thread t;
       public void init()
       {
           d=new Date();
        Font f=new Font("casteller",Font.ITALIC,56);
          setFont(f);
        t=new Thread(this);
        t.start();
         }
      public void run()
        {
           repaint();
           while(true)