java.lang.Object
java.awt.event.ComponentAdapter
com.iamsoft.util.ui.swing.mdi.WindowSnapper
- All Implemented Interfaces:
ComponentListener,EventListener
Snaps components to edge of screen.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcomponentMoved(ComponentEvent pEvt) Snap to edge after a move is completed.intHow close the component must be to to an edge before snapping.getSnapLines(Map<? extends Rectangle, Boolean> pSnapRectangles, ComponentEvent pEvt) Map from line to boolean indicating side to snap to.Map from rectangle to boolean representing whether rectangle represents a screen (true) or window (false).static voidvoidsetSnapDistance(int pSnapDistance) Methods inherited from class java.awt.event.ComponentAdapter
componentHidden, componentResized, componentShown
-
Constructor Details
-
WindowSnapper
public WindowSnapper()
-
-
Method Details
-
getSnapDistance
public int getSnapDistance()How close the component must be to to an edge before snapping. -
setSnapDistance
public void setSnapDistance(int pSnapDistance) -
componentMoved
Snap to edge after a move is completed.- Specified by:
componentMovedin interfaceComponentListener- Overrides:
componentMovedin classComponentAdapter
-
getSnapRectangles
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
-