- java.lang.Object
-
- java.awt.event.ComponentAdapter
-
- com.iamsoft.util.ui.swing.mdi.WindowSnapper
-
- All Implemented Interfaces:
ComponentListener
,EventListener
public class WindowSnapper extends ComponentAdapter
Snaps components to edge of screen.
-
-
Constructor Summary
Constructors Constructor Description WindowSnapper()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
componentMoved(ComponentEvent pEvt)
Snap to edge after a move is completed.int
getSnapDistance()
How close the component must be to to an edge before snapping.protected Map<? extends Line2D,Boolean>
getSnapLines(Map<? extends Rectangle,Boolean> pSnapRectangles, ComponentEvent pEvt)
Map from line to boolean indicating side to snap to.protected Map<? extends Rectangle,Boolean>
getSnapRectangles(ComponentEvent pEvt)
Map from rectangle to boolean representing whether rectangle represents a screen (true) or window (false).static void
main(String[] pArgs)
void
setSnapDistance(int pSnapDistance)
-
Methods inherited from class java.awt.event.ComponentAdapter
componentHidden, componentResized, componentShown
-
-
-
-
Method Detail
-
getSnapDistance
public int getSnapDistance()
How close the component must be to to an edge before snapping.
-
setSnapDistance
public void setSnapDistance(int pSnapDistance)
-
componentMoved
public void componentMoved(ComponentEvent pEvt)
Snap to edge after a move is completed.- Specified by:
componentMoved
in interfaceComponentListener
- Overrides:
componentMoved
in classComponentAdapter
-
getSnapRectangles
protected Map<? extends Rectangle,Boolean> getSnapRectangles(ComponentEvent pEvt)
Map from rectangle to boolean representing whether rectangle represents a screen (true) or window (false).
-
getSnapLines
protected Map<? extends Line2D,Boolean> getSnapLines(Map<? extends Rectangle,Boolean> pSnapRectangles, ComponentEvent pEvt)
Map from line to boolean indicating side to snap to. True means bottom/right. False means top/left. Lines should be vertical or horizontal. First point should be top/left.
-
main
public static void main(String[] pArgs)
-
-