Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My Banner Java source code
#1

Code:
import java.awt.*;
import java.applet.*;
import java.net.*;
class MyBanner extends Applet implements Runnable
{
  String msg1,msg2 ;
  Thread t = null;
  int state;
  boolean stopFlag;
  public void init()
  {
  setBackground(Color.cyan);
  setForeground(Color.red);
  }
  public void start()
  {
  msg1 = getParameter("message");
  if (msg1 == null)
  msg1 = "Message not Found";
  msg1 = " " + msg1;
  t = new Thread(this);
  stopFlag = false;
  t.start();
  }
  public void run()
  {
  char ch;
  for( ; ; )
  {
  try
  {
  repaint();
  Thread.sleep(150);
  ch = msg1.charAt(0);
  msg1 = msg1.substring(1,msg1.length());
  msg1 += ch;
  if( stopFlag ) break;
  }catch(InterruptedException e)
  {  }
  }
  }
  public void stop()
  {
  stopFlag = true;
  t = null;
  }
  public void paint(Graphics g)
  {
  g.drawString(msg1,10,10);
  URL url1 = getCodeBase();
  msg2 = "Code Base " + url1.toString() ;
  g.drawString(msg1,50,50);
  g.drawString(msg2,100,100);
  URL url2 = getDocumentBase();
  msg2 = "Document Base" + url2.toString();
  g.drawString(msg2,100,300);
  showStatus("This is Status Bar of the above Applet");
  }
}
Reply

Important Note..!

If you are not satisfied with above reply ,..Please

ASK HERE

So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page
Popular Searches: applet program in java for moving banner, moving banner in java source code, source code for moving banner in java, coding of banner moving in java using applet, a simple java prog of moving banner using applet, moving banner in java swing code, a moving banner code in java,

Forum Jump:


Users browsing this thread: 1 Guest(s)