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 which calls the method sort(int []a) which throws the Exception ArithmeticException, NullPointerException, ArrayIndexOutOfBoundsException

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

  3. Corba program to develop a simple calculator with addition, subtraction, multiplication and division capabilities, data collection from client side

  4. Program to find a factorial of a given number

  5. Corba program of game

  6. Program to show the use of While Loop

  7. Simple Applet which will show life cycle of an Applet

  8. Dialog Boxes

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

  10. Program which simulate the dictionary in java

  11. An applet program to take user input and display

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

  13. Program to show an example of creating a class and using its object

  14. Program to generate SQUARE ROOT table

  15. Program to show the use of operator (&gt;&gt;) Shift Right, propagating the sign bit from the left

  16. Program of linear search

  17. Program to show the comparing of Strings for equality

  18. Program that enabled applet that takes name of the user. Server returns back the number in uppercase clubbed with “HELLO” and display it on applet

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

  20. Encrypt the text that you want to send on the client side. The server side decrypts it after receiving. Append server time after each word in the sent

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