Thanks, i shoukd have supplied some codes, the code looks llike this:
class Tile extends JComponent{
int w, h;
Point p;
String l, s;
Tile(String l, String s){
this.l = l;
this.s = s;
w = 25;
h = 25;
p = new Point(0,0);
addMouseMotionListener(new MouseMotionAdapter() {
public void mouseDragged(MouseEvent e) {
int x = e.getX();
int y = e.getY();
if (p == null) {
} else {
p.x = x;
p.y = y;
}
repaint();
}
});
}
Thanks