Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to move a 3DRect

Status
Not open for further replies.

oluwa

Programmer
Aug 29, 2002
12
CA
hi,
I will like to know how to move a 3DRect from one JPanel to another.
Thanks
 
Sorry, I don't get the problem. Try something like this:

Code:
JPanel panel1 = new JPanel();
JPanel panel2 = new JPanel();
3DRect myRect = new 3DRect(); // whatever this is...

panel1.add(myRect); // 3DRect will be shown on panel1
wait(2000);
panel1.remove(myRect); // 3DRect will be removed from panel1
panel2.add(myRect); // 3DRect will be shown on panel2
[code]

Is it that what you were looking for?

patrick.metz@epost.de
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top