- java.lang.Object
-
- javax.swing.DefaultDesktopManager
-
- All Implemented Interfaces:
- Serializable, DesktopManager
public class DefaultDesktopManager extends Object implements DesktopManager, Serializable
This is an implementation of theDesktopManager
. It currently implements the basic behaviors for managingJInternalFrame
s in an arbitrary parent.JInternalFrame
s that are not children of aJDesktop
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.
- See Also:
JDesktopPane
,JInternalFrame
-
-
Constructor Summary
Constructors Constructor and Description DefaultDesktopManager()
-
Method Summary
Methods Modifier and Type Method and Description void
activateFrame(JInternalFrame f)
This will activate f moving it to the front.void
beginDraggingFrame(JComponent f)
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 methods is normally called when the user has indicated that they will begin resizing the frame.void
closeFrame(JInternalFrame f)
Removes the frame, and, if necessary, thedesktopIcon
, from its parent.void
deactivateFrame(JInternalFrame f)
Generally, indicate that this frame has lost focus.void
deiconifyFrame(JInternalFrame f)
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
endDraggingFrame(JComponent f)
This method signals the end of the dragging session.void
endResizingFrame(JComponent f)
This method signals the end of the resize session.protected Rectangle
getBoundsForIconOf(JInternalFrame f)
The iconifyFrame() code calls this to determine the proper bounds for the desktopIcon.protected Rectangle
getPreviousBounds(JInternalFrame f)
Gets the normal bounds of the component prior to the component being maximized.void
iconifyFrame(JInternalFrame f)
Removes the frame from its parent and adds itsdesktopIcon
to the parent.void
maximizeFrame(JInternalFrame f)
Resizes the frame to fill its parents bounds.void
minimizeFrame(JInternalFrame f)
Restores the frame back to its size and position prior to amaximizeFrame
call.void
openFrame(JInternalFrame f)
Normally this method will not be called.protected void
removeIconFor(JInternalFrame f)
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
setPreviousBounds(JInternalFrame f, Rectangle r)
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
wasIcon(JInternalFrame f)
Returnstrue
if the component has been iconized and the bounds of thedesktopIcon
are valid, otherwise returnsfalse
.
-
-
-
Method Detail
-
openFrame
public void openFrame(JInternalFrame f)
Normally this method will not be called. If it is, it try 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
-
closeFrame
public void closeFrame(JInternalFrame f)
Removes the frame, and, if necessary, thedesktopIcon
, from its parent.- Specified by:
closeFrame
in interfaceDesktopManager
- Parameters:
f
- theJInternalFrame
to be removed
-
maximizeFrame
public void maximizeFrame(JInternalFrame f)
Resizes the frame to fill its parents bounds.- Specified by:
maximizeFrame
in interfaceDesktopManager
- Parameters:
f
- the frame to be resized
-
minimizeFrame
public void minimizeFrame(JInternalFrame f)
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
public void iconifyFrame(JInternalFrame f)
Removes the frame from its parent and adds itsdesktopIcon
to the parent.- Specified by:
iconifyFrame
in interfaceDesktopManager
- Parameters:
f
- theJInternalFrame
to be iconified
-
deiconifyFrame
public void deiconifyFrame(JInternalFrame f)
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
public void activateFrame(JInternalFrame f)
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
public void deactivateFrame(JInternalFrame f)
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
-
beginDraggingFrame
public void beginDraggingFrame(JComponent f)
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
-
dragFrame
public void dragFrame(JComponent f, int newX, int newY)
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
-
endDraggingFrame
public void endDraggingFrame(JComponent f)
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
-
beginResizingFrame
public void beginResizingFrame(JComponent f, int direction)
Description copied from interface:DesktopManager
This methods 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
-
resizeFrame
public void resizeFrame(JComponent f, int newX, int newY, int newWidth, int newHeight)
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
public void endResizingFrame(JComponent f)
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
-
setBoundsForFrame
public void setBoundsForFrame(JComponent f, int newX, int newY, int newWidth, int newHeight)
This moves theJComponent
and repaints the damaged areas.- Specified by:
setBoundsForFrame
in interfaceDesktopManager
-
removeIconFor
protected void removeIconFor(JInternalFrame f)
Convenience method to remove the desktopIcon of f is necessary.
-
getBoundsForIconOf
protected Rectangle getBoundsForIconOf(JInternalFrame f)
The iconifyFrame() code calls this to determine the proper bounds for the desktopIcon.
-
setPreviousBounds
protected void setPreviousBounds(JInternalFrame f, Rectangle r)
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
protected Rectangle getPreviousBounds(JInternalFrame f)
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
protected void setWasIcon(JInternalFrame f, Boolean value)
Sets that the component has been iconized and the bounds of thedesktopIcon
are valid.
-
wasIcon
protected boolean wasIcon(JInternalFrame f)
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
-
-
Document created the 11/06/2005, last modified the 04/03/2020
Source of the printed document:https://www.gaudry.be/en/java-api-rf-javax/swing/defaultdesktopmanager.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.