Bug in SideSnapDropLayer.contains

Reproduce bug with version dockingframes-1.1.1:

  1. Save attached Bug.java, compile and run
  2. Drag one of the windows to the bottom of the window to dock it along the bottom

Expected:
Docking at bottom of frame triggers when the cursor is dragged to bottom of frame

Actual:
The cursor needs to be dragged beyond the bottom of the frame (about 20 odd pixels) before the docking location at the bottom of the frame triggers.

Notes:
The code for SideSnapDropLayer.contains that tests if the mouse is inside the component is incorrect. It is only correct when the station component is at the origin (0,0). In Bug.java, the menu bar at the top of the frame causes the station component to be at (0,23) instead of (0,0). The easiest fix is probably to zero out the bounds.x and bounds.y before doing the contains call:

	public boolean contains( int x, int y ){
		if( !station.isAllowSideSnap() ){
			return false;
		}
		Point point = new Point( x, y );
		SwingUtilities.convertPointFromScreen( point, getComponent() );
		Rectangle bounds = getComponent().getBounds();
		if( bounds.contains( point )){
			return false;
		}
...

Workaround:
The work around is to just create a JPanel to wrap the station component to make sure the station bounds is at (0,0)

Thanks, I’ll fix the bug in the next release (next weekend…).