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 to show the use of If-Else Statement

  2. Program that reads and writes random access file

  3. An applet program that concatenates two string entered in TextField

  4. Program to show the use of Logical or Boolean Negation i.e. NOT (!)

  5. 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

  6. File handling program to display directory contents

  7. RMI application for counting factorial of a given number.

  8. Program to show an example of Concatination of Strings

  9. Program that accepts a shopping list of five items from the command line and stores them in vector

  10. Program to calculate the frequency for different values of C starting from 0.01 to 0.1 in steps of 0.01

  11. Program to declare and initialize Integer variables and print them on the Standard Output Device

  12. Program to read command line arguments

  13. Program to show the use of Logical OR Operator (|) in If Statements

  14. Given a list of marks ranging form 0 to 100, write a program to compute and print the number of students marks

  15. RMI servlet program to display message

  16. Program to determine the sum of the following harmonic series for a given value of n

  17. Application which takes your marks of six subjects from the client side and displays the percentage that you have obtained

  18. GUI application in java, which enter the details of a student and on the submit display the details of the student

  19. Program to show an example of using multiple classes in a program

  20. Program to show the use of If Statement

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