Here is the code i am using. I am using my code differently and i am not sure
how to use your idea in my code.
// Create a Rectangle to select on graph
public Shape createRectangle() {
int x = 72 * 2; // This will hightlight 2 knots
int y = 72; // This will highlight 20 feet
if(maxDepth < 10) {
x = 72;
y = 36;
}
return new Rectangle2D.Double(posX, posY, x, y);
}
public void mouseClicked(MouseEvent e) {
// Not needed for drag selection
}
public void mouseEntered(MouseEvent e) {
// Not needed for drag selection
}
public void mouseExited(MouseEvent e) {
// Not needed for drag selection
}
public void mousePressed(MouseEvent e) {
mX = e.getX(); // Found where
the mouse is X
mY = e.getY(); // Found where
the mouse is Y
if(posX < mX && mX < posX + 72 + 72 && posY < mY && mY < posY + 36 +
72) { // Click within rectangle
isMouseDraggingBox = true; // Set the value to true
}
e.consume(); // Process the
event
}
public void mouseReleased(MouseEvent e) {
isMouseDraggingBox = false;
e.consume();
displayZoomView();
}
public void mouseDragged(MouseEvent e) {
if (isMouseDraggingBox) {
// Get new mouse position
int newMX = e.getX();
int newMY = e.getY();
// Move the rectangle to the new mouse position
posX += newMX - mX;
posY += newMY - mY;
// Update the new mouse position
mX = newMX;
mY = newMY;
repaint();
e.consume();
}
}
public void mouseMoved(MouseEvent e) {
// Not needed for drag selection
}
[Message sent by forum member 'ricorx7' (ricorx7)]
http://forums.java.net/jive/thread.jspa?messageID=207871
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".