Java Tutorial

 
 
 
 
/* <applet code=\"movingBanner\" height=50 width=300> </applet> */

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

public class movingBanner extends Applet implements Runnable
{
      String msg=\" A moving Banner. \";
      char ch;
      boolean  stopFlag= true;
      Thread t= null;

      public void start(){
          t = new Thread(this);
          stopFlag=false;
          t.start();
       }

       public void run(){
             for(;;){
                 try{
                repaint();
                Thread.sleep(250);
                ch = msg.charAt(0);
                msg = msg.substring(1,msg.length());
                msg = msg + ch;
                if(stopFlag)
                     break;
                }catch(InterruptedException e) {}
            }
        }

       public void stop(){
           stopFlag=true;
           t = null;
         }

         public void paint(Graphics g){
              g.drawString(msg,60,30);
        }
}

    Related Post:
  1. Program that accepts a shopping list of five items from the command line and stores them in vector

  2. Program to reverse the number eg given no : - 12345, output want :- 54321

  3. Program for calculating area of a circle on server side,when a client sends request along with given radius and then displaying result on client side

  4. An applet program to perform selection sort

  5. File handling program to display directory contents

  6. RMI application for getting the final total price of the shopping list with some of the following items and quantities chosen by the user

  7. program which takes a long sentence from the client passes to the server,server separates out each word and sends them back to client in reverse order

  8. Program to show an example of using a Non-Static Nested Class

  9. CORBA program for displaying the date and time of the server machine, client machine and the difference between these two date and time

  10. Program to delete mth element from an input string

  11. Program of inventory management and demonstrating interactive input and output

  12. Program to show an example of using user-defined package in a program

  13. Program to declare, initialize and print a StringBuffer object

  14. Socket program of HTTP Server

  15. Program to declare, initialize and print an array of characters

  16. Program to show the use of Do-While Loop

  17. Write a program for restaurant

  18. Program for Thread Priority

  19. Program to show the use of operator (&gt;&gt;&gt;) Shift Right, filling with zeros from the left

  20. An applet program to draw different shapes

 
 
Didn't find what you were looking for? Find more on An applet program to display moving banner