public abstract class AbstractResizeHotSpot extends AbstractHotSpot
AVKey.NORTH
indicates that the
HotSpot resizes the frame vertically from the north edge (the user clicks the top edge of the frame and drags
vertically).
An instance of this class should be added to the picked object when the edge or corner of the frame is picked.
Subclasses must the implement {#getSize}, {#setSize}, {#getScreenPoint}, and {#setScreenPoint} to manipulate the
frame that they want to resize.Modifier and Type | Field and Description |
---|---|
protected boolean |
adjustLocationX
True if the window needs to be moved in the X direction as it is resized.
|
protected boolean |
adjustLocationY
True if the window needs to be moved in the Y direction as it is resized.
|
protected boolean |
allowHorizontalResize |
protected boolean |
allowVerticalResize |
protected int |
cursor |
protected boolean |
dragging |
protected java.awt.Point |
dragRefPoint |
protected static int |
EAST |
protected static int |
NORTH |
protected static int |
NORTHEAST |
protected static int |
NORTHWEST |
protected java.awt.Point |
refLocation |
protected java.awt.Dimension |
refSize |
protected static int |
SOUTH |
protected static int |
SOUTHEAST |
protected static int |
SOUTHWEST |
protected static int |
WEST |
protected int |
xSign |
protected int |
ySign |
active
Constructor and Description |
---|
AbstractResizeHotSpot() |
Modifier and Type | Method and Description |
---|---|
protected void |
beginDrag(java.awt.Point point) |
void |
drag(java.awt.Point point) |
protected void |
endDrag()
Called when a drag action ends.
|
java.awt.Cursor |
getCursor()
Get a cursor for the type of resize that this hotspot handles.
|
protected java.awt.Dimension |
getMinimumSize()
Get the minimum size of the frame.
|
protected abstract java.awt.Point |
getScreenPoint()
Get the screen point of the upper left corner of the frame.
|
protected abstract java.awt.Dimension |
getSize()
Get the size of the frame.
|
boolean |
isDragging()
Is the control currently dragging?
|
protected boolean |
isValidSize(int width,
int height)
Is a frame size valid? This method is called before attempting to resize the frame.
|
void |
mouseMoved(java.awt.event.MouseEvent e)
Update the resize cursor when the mouse moves.
|
void |
selected(SelectEvent event)
Handle a
SelectEvent and call beginDrag(java.awt.Point) , drag(java.awt.Point) , endDrag() as appropriate. |
void |
setActive(boolean active)
Called when this HotSpot is activated or deactivated.
|
protected void |
setDirection(int direction) |
protected void |
setDirection(java.lang.String direction) |
protected void |
setDirectionFromPoint(java.awt.Point pickPoint)
Set the resize direction based on which point on the frame was picked (if a point on the left of the frame is
picked, the resize direction is west, if a point on the top edge is picked the resize direction is north, etc).
|
protected abstract void |
setScreenPoint(java.awt.Point newPoint)
Set the screen point of the upper left corner of the frame.
|
protected abstract void |
setSize(java.awt.Dimension newSize)
Set the size of the frame.
|
isActive, isConsumed, keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mousePressed, mouseReleased, mouseWheelMoved
addPropertyChangeListener, addPropertyChangeListener, clearList, copy, firePropertyChange, firePropertyChange, getBooleanValue, getBooleanValue, getChangeSupport, getDoubleValue, getDoubleValue, getEntries, getIntegerValue, getIntegerValue, getLongValue, getLongValue, getRestorableStateForAVPair, getStringValue, getStringValue, getStringValue, getValue, getValues, hasKey, removeKey, removePropertyChangeListener, removePropertyChangeListener, setValue, setValues
protected boolean adjustLocationX
protected boolean adjustLocationY
protected boolean allowHorizontalResize
protected boolean allowVerticalResize
protected int cursor
protected boolean dragging
protected java.awt.Point dragRefPoint
protected static final int EAST
protected static final int NORTH
protected static final int NORTHEAST
protected static final int NORTHWEST
protected java.awt.Point refLocation
protected java.awt.Dimension refSize
protected static final int SOUTH
protected static final int SOUTHEAST
protected static final int SOUTHWEST
protected static final int WEST
protected int xSign
protected int ySign
protected void beginDrag(java.awt.Point point)
public void drag(java.awt.Point point)
protected void endDrag()
dragRefPoint
to null.public java.awt.Cursor getCursor()
getCursor
in interface HotSpot
getCursor
in class AbstractHotSpot
protected java.awt.Dimension getMinimumSize()
isValidSize(int, int)
protected abstract java.awt.Point getScreenPoint()
protected abstract java.awt.Dimension getSize()
public boolean isDragging()
protected boolean isValidSize(int width, int height)
width
- Frame width.height
- Frame height.getMinimumSize()
public void mouseMoved(java.awt.event.MouseEvent e)
mouseMoved
in interface HotSpot
mouseMoved
in interface java.awt.event.MouseMotionListener
mouseMoved
in class AbstractHotSpot
e
- Mouse event.public void selected(SelectEvent event)
SelectEvent
and call beginDrag(java.awt.Point)
, drag(java.awt.Point)
, endDrag()
as appropriate. Subclasses may override this method if they need to handle events other than drag
events.selected
in interface SelectListener
selected
in interface HotSpot
selected
in class AbstractHotSpot
event
- Select event.public void setActive(boolean active)
setActive
in interface HotSpot
setActive
in class AbstractHotSpot
active
- true
if the HotSpot is being activated, false
if it is being deactivated.protected void setDirection(int direction)
protected void setDirection(java.lang.String direction)
protected void setDirectionFromPoint(java.awt.Point pickPoint)
pickPoint
- The point on the frame that was picked.protected abstract void setScreenPoint(java.awt.Point newPoint)
newPoint
- New screen point measured from upper left corner of the screen (AWT coordinates).protected abstract void setSize(java.awt.Dimension newSize)
newSize
- New frame size in pixels.