|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jidesoft.swing.Resizable
public class Resizable
Resizable
is a class that supports the resizable feature.
Resizable
uses beginResizing(int)
, resizing(int, int, int, int,
int)
and endResizing(int)
to archive the resizing effect. It should work for most cases. However if it
doesn't work as expected for some layouts, you can override one of all of the three methods to make it working.
Nested Class Summary | |
---|---|
static class |
Resizable.ResizeCorner
|
Field Summary | |
---|---|
protected JComponent |
_component
|
static int |
ALL
|
static int |
LEFT
|
static int |
LOWER
|
static int |
LOWER_LEFT
|
static int |
LOWER_RIGHT
|
static int |
NONE
|
static String |
PROPERTY_RESIZABLE_CORNERS
|
static String |
PROPERTY_RESIZE_CORNER_SIZE
|
static int |
RIGHT
|
static int |
UPPER
|
static int |
UPPER_LEFT
|
static int |
UPPER_RIGHT
|
Constructor Summary | |
---|---|
Resizable(JComponent component)
Creates a new Resizable . |
Method Summary | |
---|---|
void |
beginResizing(int resizeCorner)
This method is called when resizing operation started. |
protected MouseInputListener |
createMouseInputListener()
Creates the MouseInputListener for resizing. |
void |
endResizing(int resizeCorner)
The method is called when resizing ends. |
JComponent |
getComponent()
Gets the component which has this Resizable object. |
MouseInputListener |
getMouseInputAdapter()
Gets the mouse adapter for resizing. |
int |
getResizableCorners()
Gets the resizable corners. |
int |
getResizeCornerSize()
Gets resize corner size. |
Insets |
getResizeInsets()
Returns the insets that should be used to calculate the resize area. |
int |
getSnapGridSize()
Gets the snap grid size. |
protected void |
installListeners()
Installs the listeners needed to perform resizing operations. |
boolean |
isTopLevel()
Checks if the Resizable is added to a top level component. |
void |
resizing(int resizeCorner,
int newX,
int newY,
int newW,
int newH)
This method is called during the resizing of ResizablePanel. |
void |
setResizableCorners(int resizableCorners)
Sets resizable corners. |
void |
setResizeCornerSize(int resizeCornerSize)
Sets the resize corner size. |
void |
setResizeInsets(Insets resizeInsets)
Sets the insets the be used to calculate the resize area. |
void |
setSnapGridSize(int snapGridSize)
Sets the snap grid size. |
void |
setTopLevel(boolean topLevel)
To indicates this Resizable is installed on a top level component such as JWindow, JDialog and
JFrame v.s. |
void |
uninstallListeners()
Uninstalls the listeners that created to perform resizing operations. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int NONE
public static final int UPPER_LEFT
public static final int UPPER
public static final int UPPER_RIGHT
public static final int RIGHT
public static final int LOWER_RIGHT
public static final int LOWER
public static final int LOWER_LEFT
public static final int LEFT
public static final int ALL
public static final String PROPERTY_RESIZABLE_CORNERS
public static final String PROPERTY_RESIZE_CORNER_SIZE
protected final JComponent _component
Constructor Detail |
---|
public Resizable(JComponent component)
Resizable
. This call will make the component to be resizable.
component
- the component that should be resizable.Method Detail |
---|
public int getResizableCorners()
Resizable
.
public void setResizableCorners(int resizableCorners)
resizableCorners
- new resizable corners. The value is a bitwise OR of eight constants defined in Resizable
.public int getResizeCornerSize()
public void setResizeCornerSize(int resizeCornerSize)
resizeCornerSize
- the resize corner size.protected void installListeners()
public void uninstallListeners()
protected MouseInputListener createMouseInputListener()
public MouseInputListener getMouseInputAdapter()
public void beginResizing(int resizeCorner)
resizeCorner
- the resize corner.public void resizing(int resizeCorner, int newX, int newY, int newW, int newH)
setPreferredSize(new Dimension(newW, newH));
getParent().doLayout();
in fact, depending on where you added this ResizablePanel, you may need to override this method to do something
else. For example, ResizableWindow
uses ResizablePanel
to implement resizable feature in
JWindow. It overrides this method to call setBounds on JWindow itself.
resizeCorner
- the resize corner.newX
- the new x position.newY
- the new y position.newW
- the new width.newH
- the new height.public void endResizing(int resizeCorner)
resizeCorner
- the resize corner.public boolean isTopLevel()
If it's top level component, it will use screen coordinates to do all calculations during resizing. If resizing the resizable panel won't affect any top level container's position, you can return false here. Otherwise, return true. The default implementation always return false. Subclasses can override to return different value. In the case of ResizableWindow or ResizableDialog, this method is overridden and returns true.
public void setTopLevel(boolean topLevel)
Resizable
is installed on a top level component such as JWindow, JDialog and
JFrame v.s. a JPanel which is not a top level component because a JPanel must be added to another top level
component in order to be displayed.
topLevel
- true or false.public JComponent getComponent()
public Insets getResizeInsets()
public void setResizeInsets(Insets resizeInsets)
resizeInsets
- public int getSnapGridSize()
setSnapGridSize(int)
public void setSnapGridSize(int snapGridSize)
snapGridSize
- the grid size
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |