Monday, November 15, 2010

A Java application to display a moving banner "Wel-Come to SVICS"

/* Program : 14 
   Develop a Java application to display a moving banner "Wel-Come to SVICS"
   Developed by : Malhar Vora
   Developed on : 5-11-2010
   Development Status : Completed and tested
   Email     : vbmade2000@gmail.com
   WebSite   : www.malhar2010.blogspot.com
*************************************************************/
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class P14 extends JFrame 
{
 
 JLabel lblMsg=null;
    
 P14()
 {
   lblMsg = new JLabel("Wel-Come to SVICS");
   setSize(1000,150);
   setVisible(true);
   setTitle("Program 14 - Developed by Malhar Vora");
   setResizable(false);
   setLayout(null);
   setDefaultCloseOperation(EXIT_ON_CLOSE);
   
   lblMsg.setBounds(5,10,400,100); 
   lblMsg.setFont(new Font("Arial",Font.BOLD,30));
   lblMsg.setForeground(Color.RED);
      
   this.getContentPane().add(lblMsg);
   blink();
   
 }
   
 void blink()
 {
   
   while(true)
   {
    if(lblMsg.getLocation().getX()==1000)
    {
     lblMsg.setLocation(-260,(int)lblMsg.getLocation().getY());
    }
    lblMsg.setLocation((int)lblMsg.getLocation().getX()+5,(int)lblMsg.getLocation().getY());
    try{
       Thread.currentThread().sleep(100);
    }
    catch(Exception e)
    {
     ;
    }
   }
  
 }
    
 
 public static void main(String []str)
 {
  P14 p = new P14();
  p.setTitle("Program 14 - Developed by Malhar Vora");
 }
}

1 comment:

  1. I prefer to read this kind of stuff. The quality of content is fine and the conclusion is good. Thanks for the post


    Moving Display Board

    ReplyDelete