Powered by Ajaxy
Digg StumbleUpon LinkedIn YouTube Flickr Facebook Twitter RSS Reset

Java: Font size animation example

Java: Font size animation example
{filelink=9430}

import java.awt.Color;
import java.awt.Font;
import javax.swing.*;
public class Marqee extends JPanel implements Runnable
{
  JLabel label;
  String str;
  public Marqee(String texte)
  	{
    super();
    str=texte;
    label = new JLabel(texte);
    label.setFont(new java.awt.Font(Font.SANS_SERIF, Font.BOLD, 14));
    label.setForeground(Color.MAGENTA);
    add(label);
    Thread t = new Thread(this);
    t.start();
  }
  public void run(){
    while(true){
        char c = str.charAt(0);
        String rest = str.substring(1);
        str = rest + c;
        label.setText(str);
        try{
            Thread.sleep(200);
        }catch(InterruptedException e){ e.printStackTrace();}
    }
  }
    	public static void main (String[] args)
    		{
  JFrame frame=new JFrame("Text Animation")	;
    		 JPanel policePanel=new Marqee("welcom to java.tubedir.com");
    		 frame.add(policePanel);
    		 frame.setSize(300,200);
    		 frame.setDefaultCloseOperation(frame.EXIT_ON_CLOSE);
    		 frame.setVisible(true);
            }
 }

Users who found this page were searching for:

  • swing programming in java with example font
  • wap to print the animation in java language
  • Www java longvege font styal wap in

No comments yet.

Leave a Comment