public class DefaultDesktopManager extends Object implements DesktopManager, Serializable
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.
JDesktopPane
, JInternalFrame
public DefaultDesktopManager()
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.
openFrame
in interface DesktopManager
public void closeFrame(JInternalFrame f)
Removes the frame, and, if necessary, the desktopIcon
, from its parent.
closeFrame
in interface DesktopManager
f
- the JInternalFrame
to be removedpublic void maximizeFrame(JInternalFrame f)
Resizes the frame to fill its parents bounds.
maximizeFrame
in interface DesktopManager
f
- the frame to be resizedpublic void minimizeFrame(JInternalFrame f)
Restores the frame back to its size and position prior to a maximizeFrame
call.
minimizeFrame
in interface DesktopManager
f
- the JInternalFrame
to be restoredpublic void iconifyFrame(JInternalFrame f)
Removes the frame from its parent and adds its desktopIcon
to the parent.
iconifyFrame
in interface DesktopManager
f
- the JInternalFrame
to be iconifiedpublic void deiconifyFrame(JInternalFrame f)
Removes the desktopIcon from its parent and adds its frame to the parent.
deiconifyFrame
in interface DesktopManager
f
- the JInternalFrame
to be de-iconifiedpublic 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
to false
. There can be only one active frame across all Layers.
activateFrame
in interface DesktopManager
f
- the JInternalFrame
to be activatedpublic 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.
deactivateFrame
in interface DesktopManager
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.
beginDraggingFrame
in interface DesktopManager
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 until endDraggingFrame
is called.
dragFrame
in interface DesktopManager
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.
endDraggingFrame
in interface DesktopManager
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.
beginResizingFrame
in interface DesktopManager
public void resizeFrame(JComponent f, int newX, int newY, int newWidth, int newHeight)
Calls setBoundsForFrame
with the new values.
resizeFrame
in interface DesktopManager
f
- the component to be resizednewX
- the new x-coordinatenewY
- the new y-coordinatenewWidth
- the new widthnewHeight
- the new heightpublic 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.
endResizingFrame
in interface DesktopManager
public void setBoundsForFrame(JComponent f, int newX, int newY, int newWidth, int newHeight)
This moves the JComponent
and repaints the damaged areas.
setBoundsForFrame
in interface DesktopManager
protected void removeIconFor(JInternalFrame f)
Convenience method to remove the desktopIcon of f is necessary.
protected Rectangle getBoundsForIconOf(JInternalFrame f)
The iconifyFrame() code calls this to determine the proper bounds for the desktopIcon.
protected void setPreviousBounds(JInternalFrame f, Rectangle r)
Stores the bounds of the component just before a maximize call.
f
- the component about to be resizedr
- the normal bounds to be saved awayprotected Rectangle getPreviousBounds(JInternalFrame f)
Gets the normal bounds of the component prior to the component being maximized.
f
- the JInternalFrame
of interestprotected void setWasIcon(JInternalFrame f, Boolean value)
Sets that the component has been iconized and the bounds of the desktopIcon
are valid.
protected boolean wasIcon(JInternalFrame f)
Returns true
if the component has been iconized and the bounds of the desktopIcon
are valid, otherwise returns false
.
f
- the JInternalFrame
of interesttrue
if the component has been iconized; otherwise returns false
© 1993–2017, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.