import java.awt.*; import java.awt.event.*; import java.applet.*; public class sticky_oval extends Applet implements MouseMotionListener { int x,y; public void init() { addMouseMotionListener(this); } public void mouseMoved(MouseEvent me) { x=me.getX(); y=me.getY(); repaint(); } public void mouseDragged(MouseEvent me) { } public void paint(Graphics g) { try { g.drawOval(x,y,x,y); if(x==y) { g.setColor(Color.blue); g.fillOval(x,y,x,y); showStatus("THIS IS PERFECT CIRCLE."); Thread.sleep(4000); } else showStatus(""); } catch(InterruptedException e) { } } }
Thursday, 22 March 2012
Sticky Oval in JAVA
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment