posted 16 years ago
How to drag an array of rectangle..If its a single rectangle,then we can say,
.....
//drawing the rectangle
g2.drawrect(rectx,recty ,10,10);
....
....
public void mouseDragged(MouseEvent e)
{
//Moving the rectangle to new position
rectx = e.getx();
......
}
{code}
if this is the case,How can we move...
protected void paintComponent(Graphics g)
{for(int k = 0;k<5;k++)
{
rect.setBounds(rectx [k];k<rectx.length;k++)
g2.fill(rect);
}