Reputation: 11
I need help with to get the x and y coorinates of my mouseclick. I have decribed place and named place dialogs who saves the information by the Plats-object which is another class. I need their coordinates depending on where you click on the panel. How can my class Plats get the x and y coordinates for the mouseclick? This is my superclass
}
}
Upvotes: 1
Views: 83
Reputation: 57381
Use SwingUtilities class. It has method
public static Point convertPoint(Component source,int x, int y,Component destination)
The source is the MouseEvent mev.getSource()
destination is the target component.
Also you can use
public static void convertPointToScreen(Point p,Component c)
if you need screen coordinates
Upvotes: 2