Collect the balls in the bucket using java programming.

hello friends,
here is some codes in java check it out.
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
/**/
public class p extends Applet implements MouseMotionListener,Runnable
{
int x,y,k,i,p,px,s=0;
Image img,img1,img2;
Thread t;
String str;
public void init()
{
addMouseMotionListener(this);
t=new Thread(this);
t.start();
img=getImage(getDocumentBase(),"dem.gif"😉;
img1=getImage(getDocumentBase(),"lig.gif"😉;
img2=getImage(getDocumentBase(),"lim.gif"😉;
}
public void run()
{
for(i=0;i<=4000;i++)
{
try
{
repaint();
t.sleep(50);
k=k+5;
if(k==400)
k=0;
}
catch(Exception e)
{
System.out.println("exception "😉;
}
}
}
public void mouseDragged(MouseEvent e)
{}
public void mouseMoved(MouseEvent e)
{
repaint();
x=e.getX();
y=e.getY();
if(y>=380)
{
p=y;
}
}
public void paint(Graphics g)
{
g.drawImage(img,x,p,20,20,this);
g.drawImage(img1,20,k,20,20,this);
if(p<=k)
{
if(x>=0 && x<=22)
{
g.drawString("AAHA MIL GYA",x,p);
s++;
g.drawImage(img2,x,p,20,20,this);
}
}
str="total"+Integer.toString(s);
g.drawString(str,350,350);
}
}
Keep your own images and provide the addresses for them.
Enjoy it.

Replies

You are reading an archived discussion.

Related Posts

TECHNICAL EVENTS Paper & Poster Presentation Competition SimPlant Quiz Dexter's Lab Industry Defined Problem Technical Debate Model Making Event Business Plan Presentation Pharmascopia NON TECHNICAL EVENTS The Amazing Race Bulls...
Check the details of the Quiz here: Exergy 2011 - Think Different Let's discuss the answers to these questions
Free Software Movement of India (FSMI) is organizing the National Convention for Academics and Research (NCAR) 2010 at Hyderabad for spreading awareness of Free/Libre and Open Source Software (FOSS /...
Hey guys, could anyone help me in understanding using control vectors and hashing to provide encrypted session key in cryptograpgy how the vector can describe a key usage? is this...
I've represented Google at many events for women in engineering, and I'm always asked the same thing: "What's it like to work there?" I certainly don't mind discussing the subject,...