Social Icons

Saturday, 26 October 2013

Right Moving String in Java Applet

import java.awt.*;
import java.awt.event.*;
import java.applet.*;
/*

<applet code=jitender width=400 height=400>
</applet>

*/


public class jitender extends Applet implements Runnable
{
Thread t=null;
boolean stopflag;
String msg,ch1;





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

 public void start()
  {
  msg="A simple jitender moving";
if(msg==null)
 {
  msg="message not found";
 }
msg=" "+msg;
 t=new Thread(this);
 stopflag=false;
  t.start();
}

public void run()
{
char ch;
String ch1;

 char p1[]=msg.toCharArray();
for( ; ;)
{
 try
   {
repaint();
Thread.sleep(250);

ch=p1[p1.length-1];

for(int i=p1.length-1;i>0;i--)
{
   p1[i]=p1[i-1];
 }
 p1[0]=ch;
ch1= String.valueOf(p1);
 msg=ch1;












   if(stopflag)
    {
    break;
     }


   }catch(InterruptedException e){}


}

}

public void stop()
{
   stopflag=true;
    t=null;
}

public void paint(Graphics g)
{
g.drawString(msg,50,30);
}

}

Sunday, 20 October 2013

dbms pl/sql curser

set serveroutput on;
DECLARE
   total_rows number(2);
BEGIN
   UPDATE e1111
   SET esalary = esalary + 500;
   IF sql%notfound THEN
      dbms_output.put_line('no customers selected');
   ELSIF sql%found THEN
      total_rows := sql%rowcount;
      dbms_output.put_line( total_rows || ' customers selected ');
   END IF;
END;
 

Sample Text

Sample text

 
Just Programming Cse DriveReputation Management