Java Blog

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

public class simpleBanner extends Applet implements Runnable
{
      String msg=\" A Simple Moving Banner. \";
      Thread t=null;
      int state;
      boolean stopflag;

      public void init()
      {
           setBackground(Color.yellow);
           setForeground(Color.red);
      }

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

     public void run()
     {
          char ch;
          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,50,30);
          showStatus(\"Simple Banner\");
    }

}

    Related Post:
  1. Program to find a factorial of a given number

  2. Program which creates an Array of character. Make one function with one argument as a character and that function throw a user defined exception

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

  4. CORBA PROGRAM TO GET THE HTML CODE FROM ANY URL

  5. Program to show an example of Polymorphism

  6. Program of creating a file using text fields in windows

  7. Corba program to encrypt the text that you want to send on the client side. The server side decrypts it after receiving. Append server time.

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

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

  10. Program to display Floyds Triangle of a numbers

  11. Program to show the use of Conditional (Ternary) Operator

  12. Program in CORBA which takes a long sentence from the client (at least 7 words), passes to the server, server separates out each word

  13. An applet program to display Vertical Color Bar

  14. Program which calls the method sort(int []a) which throws the Exception ArithmeticException, NullPointerException, ArrayIndexOutOfBoundsException

  15. Program of FTP client and server

  16. Program to compare Strings by compring successive corresponding characters, starting with the first character in each String

  17. Program to show an example of modifying String objects

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

  19. Program to delete mth element from an input string

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

 
 
Didn't find what you were looking for? Find more on An applet of displaying simple moving banner