thanks SvH and Ritchie ......
but i am not getting your idea......
actually i have not studied 2D in detail,so i don't know much about it.
so you can check my code so that you can get in better way what i want..
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
public class DrawTest extends Frame implements Runnable
{
int a=0,b=0;
//Shape circle = new Ellipse2D.Float(100.0f, 100.0f, 100.0f, 100.0f);
// Tread t;
//t=new Tread(this);
//t.start();
public void run()
{
}
public void paint(Graphics g)
{
Graphics2D ga = (Graphics2D)g;
// ga.draw(circle);
// ga.setPaint(Color.green);
// ga.fill(circle);
ga.setPaint(Color.red);
for(int i=500;i>0;i--)
{
try
{
Thread.sleep(10);
Shape square = new Rectangle2D.Double(50+a, 50,50+b, 50);
//setVisible(false);
ga.draw(square);
// repaint();
a++;
b++;
}
catch(Exception r)
{}
}
}
public static void main(
String args[]) {
Frame frame = new DrawTest();
frame.addWindowListener(new WindowAdapter()
{
public void windowClosing(WindowEvent we)
{
System.exit(0);
}
});
frame.setSize(500, 550);
frame.setVisible(true);
}
}
now you can run this code ......
and check output.
but i want that it look like a moving rectangle.not a mixed
pattern.