- 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.
- See Also:
JDesktopPane,JInternalFrame
-
-
Constructor Summary
Constructors Constructor and Description DefaultDesktopManager()
-
Method Summary
Methods Modifier and Type Method and Description voidactivateFrame(JInternalFrame f)This will activate f moving it to the front.voidbeginDraggingFrame(JComponent f)This method is normally called when the user has indicated that they will begin dragging a component around.voidbeginResizingFrame(JComponent f, int direction)This methods is normally called when the user has indicated that they will begin resizing the frame.voidcloseFrame(JInternalFrame f)Removes the frame, and, if necessary, thedesktopIcon, from its parent.voiddeactivateFrame(JInternalFrame f)Generally, indicate that this frame has lost focus.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.voidendDraggingFrame(JComponent f)This method signals the end of the dragging session.voidendResizingFrame(JComponent f)This method signals the end of the resize session.protected RectanglegetBoundsForIconOf(JInternalFrame f)The iconifyFrame() 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.
-
-
-
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:
openFramein interfaceDesktopManager
-
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
-
deactivateFrame
public void deactivateFrame(JInternalFrame f)
Description copied from interface:DesktopManagerGenerally, 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:
deactivateFramein interfaceDesktopManager
-
beginDraggingFrame
public void beginDraggingFrame(JComponent f)
Description copied from interface:DesktopManagerThis 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:
beginDraggingFramein 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 untilendDraggingFrameis called.- Specified by:
dragFramein interfaceDesktopManager
-
endDraggingFrame
public void endDraggingFrame(JComponent f)
Description copied from interface:DesktopManagerThis 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:
endDraggingFramein interfaceDesktopManager
-
beginResizingFrame
public void beginResizingFrame(JComponent f, int direction)
Description copied from interface:DesktopManagerThis 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:
beginResizingFramein interfaceDesktopManager
-
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
-
endResizingFrame
public void endResizingFrame(JComponent f)
Description copied from interface:DesktopManagerThis 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:
endResizingFramein interfaceDesktopManager
-
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
-
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- 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.
-
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
-
-
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 11/06/2005 gemaakt, de laatste keer de 04/03/2020 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-rf-javax/swing/defaultdesktopmanager.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur van deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.