- 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 voidcomponentMoved(ComponentEvent pEvt)Snap to edge after a move is completed.intgetSnapDistance()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 voidmain(String[] pArgs)voidsetSnapDistance(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:
componentMovedin interfaceComponentListener- Overrides:
componentMovedin 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)
-
-