java.lang.Object
javax.swing.DefaultDesktopManager
- All Implemented Interfaces:
Serializable
,DesktopManager
This is an implementation of the
DesktopManager
.
It currently implements the basic behaviors for managing
JInternalFrame
s in an arbitrary parent.
JInternalFrame
s that are not children of a
JDesktop
will use this component
to handle their desktop-like actions.
This class provides a policy for the various JInternalFrame methods, it is not meant to be called directly rather the various JInternalFrame methods will call into the DesktopManager.
- Since:
- 1.2
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
This will activate f moving it to the front.void
This method is normally called when the user has indicated that they will begin dragging a component around.void
beginResizingFrame
(JComponent f, int direction) This method is normally called when the user has indicated that they will begin resizing the frame.void
Removes the frame, and, if necessary, thedesktopIcon
, from its parent.void
Generally, indicate that this frame has lost focus.void
Removes the desktopIcon from its parent and adds its frame to the parent.void
dragFrame
(JComponent f, int newX, int newY) Moves the visible location of the frame being dragged to the location specified.void
This method signals the end of the dragging session.void
This method signals the end of the resize session.protected Rectangle
TheiconifyFrame()
code calls this to determine the proper bounds for the desktopIcon.protected Rectangle
Gets the normal bounds of the component prior to the component being maximized.void
Removes the frame from its parent and adds itsdesktopIcon
to the parent.void
Resizes the frame to fill its parents bounds.void
Restores the frame back to its size and position prior to amaximizeFrame
call.void
Normally this method will not be called.protected void
Convenience method to remove the desktopIcon of f is necessary.void
resizeFrame
(JComponent f, int newX, int newY, int newWidth, int newHeight) CallssetBoundsForFrame
with the new values.void
setBoundsForFrame
(JComponent f, int newX, int newY, int newWidth, int newHeight) This moves theJComponent
and repaints the damaged areas.protected void
Stores the bounds of the component just before a maximize call.protected void
setWasIcon
(JInternalFrame f, Boolean value) Sets that the component has been iconized and the bounds of thedesktopIcon
are valid.protected boolean
Returnstrue
if the component has been iconized and the bounds of thedesktopIcon
are valid, otherwise returnsfalse
.
-
Constructor Details
-
DefaultDesktopManager
public DefaultDesktopManager()Constructs aDefaultDesktopManager
.
-
-
Method Details
-
openFrame
Normally this method will not be called. If it is, it tries to determine the appropriate parent from the desktopIcon of the frame. Will remove the desktopIcon from its parent if it successfully adds the frame.- Specified by:
openFrame
in interfaceDesktopManager
- Parameters:
f
- theJInternalFrame
to be displayed
-
closeFrame
Removes the frame, and, if necessary, thedesktopIcon
, from its parent.- Specified by:
closeFrame
in interfaceDesktopManager
- Parameters:
f
- theJInternalFrame
to be removed
-
maximizeFrame
Resizes the frame to fill its parents bounds.- Specified by:
maximizeFrame
in interfaceDesktopManager
- Parameters:
f
- the frame to be resized
-
minimizeFrame
Restores the frame back to its size and position prior to amaximizeFrame
call.- Specified by:
minimizeFrame
in interfaceDesktopManager
- Parameters:
f
- theJInternalFrame
to be restored
-
iconifyFrame
Removes the frame from its parent and adds itsdesktopIcon
to the parent.- Specified by:
iconifyFrame
in interfaceDesktopManager
- Parameters:
f
- theJInternalFrame
to be iconified
-
deiconifyFrame
Removes the desktopIcon from its parent and adds its frame to the parent.- Specified by:
deiconifyFrame
in interfaceDesktopManager
- Parameters:
f
- theJInternalFrame
to be de-iconified
-
activateFrame
This will activate f moving it to the front. It will set the current active frame's (if any)IS_SELECTED_PROPERTY
tofalse
. There can be only one active frame across all Layers.- Specified by:
activateFrame
in interfaceDesktopManager
- Parameters:
f
- theJInternalFrame
to be activated
-
deactivateFrame
Description copied from interface:DesktopManager
Generally, indicate that this frame has lost focus. This is usually called after the JInternalFrame's IS_SELECTED_PROPERTY has been set to false.- Specified by:
deactivateFrame
in interfaceDesktopManager
- Parameters:
f
- theJInternalFrame
to be deactivated
-
beginDraggingFrame
Description copied from interface:DesktopManager
This method is normally called when the user has indicated that they will begin dragging a component around. This method should be called prior to any dragFrame() calls to allow the DesktopManager to prepare any necessary state. Normally f will be a JInternalFrame.- Specified by:
beginDraggingFrame
in interfaceDesktopManager
- Parameters:
f
- theJComponent
being dragged
-
dragFrame
Moves the visible location of the frame being dragged to the location specified. The means by which this occurs can vary depending on the dragging algorithm being used. The actual logical location of the frame might not change untilendDraggingFrame
is called.- Specified by:
dragFrame
in interfaceDesktopManager
- Parameters:
f
- theJComponent
being draggednewX
- the new x-coordinatenewY
- the new y-coordinate
-
endDraggingFrame
Description copied from interface:DesktopManager
This method signals the end of the dragging session. Any state maintained by the DesktopManager can be removed here. Normally f will be a JInternalFrame.- Specified by:
endDraggingFrame
in interfaceDesktopManager
- Parameters:
f
- theJComponent
being dragged
-
beginResizingFrame
Description copied from interface:DesktopManager
This method is normally called when the user has indicated that they will begin resizing the frame. This method should be called prior to any resizeFrame() calls to allow the DesktopManager to prepare any necessary state. Normally f will be a JInternalFrame.- Specified by:
beginResizingFrame
in interfaceDesktopManager
- Parameters:
f
- theJComponent
being resizeddirection
- the direction
-
resizeFrame
CallssetBoundsForFrame
with the new values.- Specified by:
resizeFrame
in interfaceDesktopManager
- Parameters:
f
- the component to be resizednewX
- the new x-coordinatenewY
- the new y-coordinatenewWidth
- the new widthnewHeight
- the new height
-
endResizingFrame
Description copied from interface:DesktopManager
This method signals the end of the resize session. Any state maintained by the DesktopManager can be removed here. Normally f will be a JInternalFrame.- Specified by:
endResizingFrame
in interfaceDesktopManager
- Parameters:
f
- theJComponent
being resized
-
setBoundsForFrame
This moves theJComponent
and repaints the damaged areas.- Specified by:
setBoundsForFrame
in interfaceDesktopManager
- Parameters:
f
- theJComponent
being moved or resizednewX
- the new x-coordinatenewY
- the new y-coordinatenewWidth
- the new widthnewHeight
- the new height
-
removeIconFor
Convenience method to remove the desktopIcon of f is necessary.- Parameters:
f
- theJInternalFrame
for which to remove thedesktopIcon
-
getBoundsForIconOf
TheiconifyFrame()
code calls this to determine the proper bounds for the desktopIcon.- Parameters:
f
- theJInternalFrame
of interest- Returns:
- a
Rectangle
containing bounds for thedesktopIcon
-
setPreviousBounds
Stores the bounds of the component just before a maximize call.- Parameters:
f
- the component about to be resizedr
- the normal bounds to be saved away
-
getPreviousBounds
Gets the normal bounds of the component prior to the component being maximized.- Parameters:
f
- theJInternalFrame
of interest- Returns:
- the normal bounds of the component
-
setWasIcon
Sets that the component has been iconized and the bounds of thedesktopIcon
are valid.- Parameters:
f
- theJInternalFrame
of interestvalue
- aBoolean
signifying if component has been iconized
-
wasIcon
Returnstrue
if the component has been iconized and the bounds of thedesktopIcon
are valid, otherwise returnsfalse
.- Parameters:
f
- theJInternalFrame
of interest- Returns:
true
if the component has been iconized; otherwise returnsfalse
-