Sunday 20 January 2013

A moving Banner in Java with Applet


import java.awt.*;
import java.applet.*;
/*
<applet code="ParamBanner" width=300 height=50>
<param name=message value="Java makes the Web move!">
</applet>
*/
public class ParamBanner extends Applet implements Runnable
          {
String msg;
Thread t = null;
int state;
boolean stopFlag;
// Set colors and initialize thread.
public void init()
    {
               setBackground(Color.cyan);
               setForeground(Color.red);
                       }
// Start thread
public void start()
                       {
                 msg = getParameter("message");
if(msg == null) msg = "Message not found.";
msg = " " + msg;
t = new Thread(this);
stopFlag = false;
t.start();
       }

No comments:

Post a Comment