public class ComponentResizer extends MouseAdapter
| Modifier and Type | Field and Description |
|---|---|
protected Map<Component,String> |
authorizedDirectionByComponent |
static String |
DIRECTION_BOTH |
static String |
DIRECTION_HORIZONTAL |
static String |
DIRECTION_VERTICAL |
protected static int |
EAST |
protected static int |
NORTH |
protected static int |
SOUTH |
protected static int |
WEST |
| Constructor and Description |
|---|
ComponentResizer()
Convenience contructor.
|
ComponentResizer(Component... components)
Convenience contructor.
|
ComponentResizer(Insets dragInsets,
Component... components)
Convenience contructor.
|
ComponentResizer(Insets dragInsets,
Dimension snapSize,
Component... components)
Create a ComponentResizer.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
changeBounds(Component source,
int direction,
Rectangle bounds,
Point pressed,
Point current) |
void |
deregisterComponent(Component... components)
Remove listeners from the specified component
|
Insets |
getDragInsets()
Get the drag insets
|
Dimension |
getMaximumSize()
Get the components maximum size.
|
Dimension |
getMinimumSize()
Get the components minimum size.
|
Dimension |
getSnapSize()
Get the snap size.
|
void |
mouseDragged(MouseEvent e)
Resize the component ensuring location and size is within the bounds
of the parent container and that the size is within the minimum and
maximum constraints.
|
void |
mouseEntered(MouseEvent e) |
void |
mouseExited(MouseEvent e) |
void |
mouseMoved(MouseEvent e) |
void |
mousePressed(MouseEvent e) |
void |
mouseReleased(MouseEvent e)
Restore the original state of the Component
|
void |
registerComponent(Component... components)
Add the required listeners to the specified component
|
void |
registerComponent(String authorizedDirection,
Component... components) |
void |
setDragInsets(Insets dragInsets)
Set the drag dragInsets.
|
void |
setMaximumSize(Dimension maximumSize)
Specify the maximum size for the component.
|
void |
setMinimumSize(Dimension minimumSize)
Specify the minimum size for the component.
|
void |
setSnapSize(Dimension snapSize)
Control how many pixels a border must be dragged before the size of
the component is changed.
|
mouseClicked, mouseWheelMovedpublic static final String DIRECTION_VERTICAL
public static final String DIRECTION_HORIZONTAL
public static final String DIRECTION_BOTH
protected static final int NORTH
protected static final int WEST
protected static final int SOUTH
protected static final int EAST
public ComponentResizer()
public ComponentResizer(Component... components)
components - components to be automatically registeredpublic ComponentResizer(Insets dragInsets, Component... components)
dragInsets - Insets specifying which borders are eligible to be
resized.components - components to be automatically registeredpublic ComponentResizer(Insets dragInsets, Dimension snapSize, Component... components)
dragInsets - Insets specifying which borders are eligible to be
resized.snapSize - Specify the dimension to which the border will snap to
when being dragged. Snapping occurs at the halfway mark.components - components to be automatically registeredpublic Insets getDragInsets()
public void setDragInsets(Insets dragInsets)
dragInsets - Insets to control which borders are resizeable.public Dimension getMaximumSize()
public void setMaximumSize(Dimension maximumSize)
maximumSize - the maximum size for a component.public Dimension getMinimumSize()
public void setMinimumSize(Dimension minimumSize)
minimumSize - the minimum size for a component.public void deregisterComponent(Component... components)
components - the component the listeners are removed frompublic void registerComponent(Component... components)
components - the component the listeners are added topublic void registerComponent(String authorizedDirection, Component... components)
public Dimension getSnapSize()
public void setSnapSize(Dimension snapSize)
snapSize - Dimension object allows you to separately spcify a
horizontal and vertical snap size.public void mouseMoved(MouseEvent e)
mouseMoved in interface MouseMotionListenermouseMoved in class MouseAdapterpublic void mouseEntered(MouseEvent e)
mouseEntered in interface MouseListenermouseEntered in class MouseAdapterpublic void mouseExited(MouseEvent e)
mouseExited in interface MouseListenermouseExited in class MouseAdapterpublic void mousePressed(MouseEvent e)
mousePressed in interface MouseListenermousePressed in class MouseAdapterpublic void mouseReleased(MouseEvent e)
mouseReleased in interface MouseListenermouseReleased in class MouseAdapterpublic void mouseDragged(MouseEvent e)
mouseDragged in interface MouseMotionListenermouseDragged in class MouseAdapterCopyright © 2008–2019 Ultreia.io. All rights reserved.