- 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 managingJInternalFrames in an arbitrary parent.JInternalFrames that are not children of aJDesktopwill 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:
JDesktopPane,JInternalFrame, Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DefaultDesktopManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactivateFrame(JInternalFrame f)This will activate f moving it to the front.voidcloseFrame(JInternalFrame f)Removes the frame, and, if necessary, thedesktopIcon, from its parent.voiddeiconifyFrame(JInternalFrame f)Removes the desktopIcon from its parent and adds its frame to the parent.voiddragFrame(JComponent f, int newX, int newY)Moves the visible location of the frame being dragged to the location specified.protected RectanglegetBoundsForIconOf(JInternalFrame f)TheiconifyFrame()code calls this to determine the proper bounds for the desktopIcon.protected RectanglegetPreviousBounds(JInternalFrame f)Gets the normal bounds of the component prior to the component being maximized.voidiconifyFrame(JInternalFrame f)Removes the frame from its parent and adds itsdesktopIconto the parent.voidmaximizeFrame(JInternalFrame f)Resizes the frame to fill its parents bounds.voidminimizeFrame(JInternalFrame f)Restores the frame back to its size and position prior to amaximizeFramecall.voidopenFrame(JInternalFrame f)Normally this method will not be called.protected voidremoveIconFor(JInternalFrame f)Convenience method to remove the desktopIcon of f is necessary.voidresizeFrame(JComponent f, int newX, int newY, int newWidth, int newHeight)CallssetBoundsForFramewith the new values.voidsetBoundsForFrame(JComponent f, int newX, int newY, int newWidth, int newHeight)This moves theJComponentand repaints the damaged areas.protected voidsetPreviousBounds(JInternalFrame f, Rectangle r)Stores the bounds of the component just before a maximize call.protected voidsetWasIcon(JInternalFrame f, Boolean value)Sets that the component has been iconized and the bounds of thedesktopIconare valid.protected booleanwasIcon(JInternalFrame f)Returnstrueif the component has been iconized and the bounds of thedesktopIconare valid, otherwise returnsfalse.-
Methods declared in class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods declared in interface javax.swing.DesktopManager
beginDraggingFrame, beginResizingFrame, deactivateFrame, endDraggingFrame, endResizingFrame
-
-
-
-
Method Detail
-
openFrame
public void openFrame(JInternalFrame f)
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:
openFramein interfaceDesktopManager- Parameters:
f- theJInternalFrameto be displayed
-
closeFrame
public void closeFrame(JInternalFrame f)
Removes the frame, and, if necessary, thedesktopIcon, from its parent.- Specified by:
closeFramein interfaceDesktopManager- Parameters:
f- theJInternalFrameto be removed
-
maximizeFrame
public void maximizeFrame(JInternalFrame f)
Resizes the frame to fill its parents bounds.- Specified by:
maximizeFramein 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 amaximizeFramecall.- Specified by:
minimizeFramein interfaceDesktopManager- Parameters:
f- theJInternalFrameto be restored
-
iconifyFrame
public void iconifyFrame(JInternalFrame f)
Removes the frame from its parent and adds itsdesktopIconto the parent.- Specified by:
iconifyFramein interfaceDesktopManager- Parameters:
f- theJInternalFrameto be iconified
-
deiconifyFrame
public void deiconifyFrame(JInternalFrame f)
Removes the desktopIcon from its parent and adds its frame to the parent.- Specified by:
deiconifyFramein interfaceDesktopManager- Parameters:
f- theJInternalFrameto 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_PROPERTYtofalse. There can be only one active frame across all Layers.- Specified by:
activateFramein interfaceDesktopManager- Parameters:
f- theJInternalFrameto be activated
-
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 untilendDraggingFrameis called.- Specified by:
dragFramein interfaceDesktopManager- Parameters:
f- theJComponentbeing draggednewX- the new x-coordinatenewY- the new y-coordinate
-
resizeFrame
public void resizeFrame(JComponent f, int newX, int newY, int newWidth, int newHeight)
CallssetBoundsForFramewith the new values.- Specified by:
resizeFramein interfaceDesktopManager- Parameters:
f- the component to be resizednewX- the new x-coordinatenewY- the new y-coordinatenewWidth- the new widthnewHeight- the new height
-
setBoundsForFrame
public void setBoundsForFrame(JComponent f, int newX, int newY, int newWidth, int newHeight)
This moves theJComponentand repaints the damaged areas.- Specified by:
setBoundsForFramein interfaceDesktopManager- Parameters:
f- theJComponentbeing moved or resizednewX- the new x-coordinatenewY- the new y-coordinatenewWidth- the new widthnewHeight- the new height
-
removeIconFor
protected void removeIconFor(JInternalFrame f)
Convenience method to remove the desktopIcon of f is necessary.- Parameters:
f- theJInternalFramefor which to remove thedesktopIcon
-
getBoundsForIconOf
protected Rectangle getBoundsForIconOf(JInternalFrame f)
TheiconifyFrame()code calls this to determine the proper bounds for the desktopIcon.- Parameters:
f- theJInternalFrameof interest- Returns:
- a
Rectanglecontaining bounds for thedesktopIcon
-
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- theJInternalFrameof 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 thedesktopIconare valid.- Parameters:
f- theJInternalFrameof interestvalue- aBooleansignifying if component has been iconized
-
wasIcon
protected boolean wasIcon(JInternalFrame f)
Returnstrueif the component has been iconized and the bounds of thedesktopIconare valid, otherwise returnsfalse.- Parameters:
f- theJInternalFrameof interest- Returns:
trueif the component has been iconized; otherwise returnsfalse
-
-