Path: blob/master/src/java.desktop/share/classes/javax/swing/DesktopManager.java
41153 views
/*1* Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.swing;2627/** DesktopManager objects are owned by a JDesktopPane object. They are responsible28* for implementing L&F specific behaviors for the JDesktopPane. JInternalFrame29* implementations should delegate specific behaviors to the DesktopManager. For30* instance, if a JInternalFrame was asked to iconify, it should try:31* <PRE>32* getDesktopPane().getDesktopManager().iconifyFrame(frame);33* </PRE>34* This delegation allows each L&F to provide custom behaviors for desktop-specific35* actions. (For example, how and where the internal frame's icon would appear.)36* <p>This class provides a policy for the various JInternalFrame methods, it is not37* meant to be called directly rather the various JInternalFrame methods will call38* into the DesktopManager.</p>39*40* @see JDesktopPane41* @see JInternalFrame42* @see JInternalFrame.JDesktopIcon43*44* @author David Kloba45* @since 1.246*/47public interface DesktopManager48{49/**50* If possible, display this frame in an appropriate location.51* Normally, this is not called, as the creator of the JInternalFrame52* will add the frame to the appropriate parent.53*54* @param f the {@code JInternalFrame} to be displayed55*/56void openFrame(JInternalFrame f);5758/**59* Generally, this call should remove the frame from its parent.60*61* @param f the {@code JInternalFrame} to be removed62*/63void closeFrame(JInternalFrame f);6465/**66* Generally, the frame should be resized to match its parents bounds.67*68* @param f the {@code JInternalFrame} to be resized69*/70void maximizeFrame(JInternalFrame f);7172/**73* Generally, this indicates that the frame should be restored to its74* size and position prior to a maximizeFrame() call.75*76* @param f the {@code JInternalFrame} to be restored77*/78void minimizeFrame(JInternalFrame f);7980/**81* Generally, remove this frame from its parent and add an iconic representation.82*83* @param f the {@code JInternalFrame} to be iconified84*/85void iconifyFrame(JInternalFrame f);8687/**88* Generally, remove any iconic representation that is present and restore the89* frame to it's original size and location.90*91* @param f the {@code JInternalFrame} to be de-iconified92*/93void deiconifyFrame(JInternalFrame f);9495/**96* Generally, indicate that this frame has focus. This is usually called after97* the JInternalFrame's IS_SELECTED_PROPERTY has been set to true.98*99* @param f the {@code JInternalFrame} to be activated100*/101void activateFrame(JInternalFrame f);102103/**104* Generally, indicate that this frame has lost focus. This is usually called105* after the JInternalFrame's IS_SELECTED_PROPERTY has been set to false.106*107* @param f the {@code JInternalFrame} to be deactivated108*/109void deactivateFrame(JInternalFrame f);110111/**112* This method is normally called when the user has indicated that113* they will begin dragging a component around. This method should be called114* prior to any dragFrame() calls to allow the DesktopManager to prepare any115* necessary state. Normally <b>f</b> will be a JInternalFrame.116*117* @param f the {@code JComponent} being dragged118*/119void beginDraggingFrame(JComponent f);120121/**122* The user has moved the frame. Calls to this method will be preceded by calls123* to beginDraggingFrame().124* Normally <b>f</b> will be a JInternalFrame.125*126* @param f the {@code JComponent} being dragged127* @param newX the new x-coordinate128* @param newY the new y-coordinate129*/130void dragFrame(JComponent f, int newX, int newY);131132/**133* This method signals the end of the dragging session. Any state maintained by134* the DesktopManager can be removed here. Normally <b>f</b> will be a JInternalFrame.135*136* @param f the {@code JComponent} being dragged137*/138void endDraggingFrame(JComponent f);139140/**141* This method is normally called when the user has indicated that142* they will begin resizing the frame. This method should be called143* prior to any resizeFrame() calls to allow the DesktopManager to prepare any144* necessary state. Normally <b>f</b> will be a JInternalFrame.145*146* @param f the {@code JComponent} being resized147* @param direction the direction148*/149void beginResizingFrame(JComponent f, int direction);150151/**152* The user has resized the component. Calls to this method will be preceded by calls153* to beginResizingFrame().154* Normally <b>f</b> will be a JInternalFrame.155*156* @param f the {@code JComponent} being resized157* @param newX the new x-coordinate158* @param newY the new y-coordinate159* @param newWidth the new width160* @param newHeight the new height161*/162void resizeFrame(JComponent f, int newX, int newY, int newWidth, int newHeight);163164/**165* This method signals the end of the resize session. Any state maintained by166* the DesktopManager can be removed here. Normally <b>f</b> will be a JInternalFrame.167*168* @param f the {@code JComponent} being resized169*/170void endResizingFrame(JComponent f);171172/**173* This is a primitive reshape method.174*175* @param f the {@code JComponent} being moved or resized176* @param newX the new x-coordinate177* @param newY the new y-coordinate178* @param newWidth the new width179* @param newHeight the new height180*/181void setBoundsForFrame(JComponent f, int newX, int newY, int newWidth, int newHeight);182}183184185