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. Corba program of reverse string

  2. Define an array of ten String elements each containing an arbitrary string of the form “month/day/year”

  3. An applet program to display sum of two number of textField

  4. Program to read the table elements into a two-dimensional array temperature

  5. Develop a game application in CORBA for which the player will guess a number between 1 to 100, which will be compared to the random number generated b

  6. Program of concatenating and Buffering files

  7. Program sets up a String variable containing a paragraph of text of your choice. Extract the words from the text and sort them into alphabetical order

  8. Program to show the use of Labeled Continue Statement

  9. Program to show an example of Multiple Levels of Inheritance

  10. Program to show the comparing of Strings for equality

  11. Program to show the use of Nested Loops

  12. Program that will read real number from the keyboard and print the following output in one line: small Integer not less The Given Number Largest Int

  13. corba program of client and a DNS server where given a URL the server sends back an IP address

  14. Write a class whose objects holds a current value and have a method to add that value, printing the new value

  15. Program to show an example of getting at characters in a String

  16. Program to show the use of Labeled Break Statement

  17. Program to search an element in an array using Linear Search

  18. Develop a CORBA application that takes a string from client and returns whether it is palindrome

  19. An applet program to display text

  20. An applet program that displays Text at the center of the string which is passed as parameter

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