Java Code Examples for javax.swing.JComponent.getLocationOnScreen()

The following are Jave code examples for showing how to use getLocationOnScreen() of the javax.swing.JComponent class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: Equella   File: LDAPMappingPanel.java   View Source Code Vote up 6 votes
public Point canDrag(MouseEvent e, JComponent table)
{
	Point p2 = table.getLocationOnScreen();
	Point p1 = directory.getLocationOnScreen();
	Point p = e.getPoint();

	Point p3 = new Point();
	p3.x = p1.x + p.x - p2.x;
	p3.y = p1.y + p.y - p2.y;

	if( table.contains(p3) && dragString.length() != 0 )
	{
		return p3;
	}
	else
	{
		return null;
	}
}