1 /* 2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. Oracle designates this 8 * particular file as subject to the "Classpath" exception as provided 9 * by Oracle in the LICENSE file that accompanied this code. 10 * 11 * This code is distributed in the hope that it will be useful, but WITHOUT 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14 * version 2 for more details (a copy is included in the LICENSE file that 15 * accompanied this code). 16 * 17 * You should have received a copy of the GNU General Public License version 18 * 2 along with this work; if not, write to the Free Software Foundation, 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20 * 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package javax.swing; 27 28 /** DesktopManager objects are owned by a JDesktopPane object. They are responsible 29 * for implementing L&F specific behaviors for the JDesktopPane. JInternalFrame 30 * implementations should delegate specific behaviors to the DesktopManager. For 31 * instance, if a JInternalFrame was asked to iconify, it should try: 32 * <PRE> 33 * getDesktopPane().getDesktopManager().iconifyFrame(frame); 34 * </PRE> 35 * This delegation allows each L&F to provide custom behaviors for desktop-specific 36 * actions. (For example, how and where the internal frame's icon would appear.) 37 * <p>This class provides a policy for the various JInternalFrame methods, it is not 38 * meant to be called directly rather the various JInternalFrame methods will call 39 * into the DesktopManager.</p> 40 * 41 * @see JDesktopPane 42 * @see JInternalFrame 43 * @see JInternalFrame.JDesktopIcon 44 * 45 * @author David Kloba 46 * @since 1.2 47 */ 48 public interface DesktopManager 49 { 50 /** If possible, display this frame in an appropriate location. 51 * Normally, this is not called, as the creator of the JInternalFrame 52 * will add the frame to the appropriate parent. 53 */ 54 void openFrame(JInternalFrame f); 55 56 /** Generally, this call should remove the frame from it's parent. */ 57 void closeFrame(JInternalFrame f); 58 59 /** Generally, the frame should be resized to match it's parents bounds. */ 60 void maximizeFrame(JInternalFrame f); 61 /** Generally, this indicates that the frame should be restored to it's 62 * size and position prior to a maximizeFrame() call. 63 */ 64 void minimizeFrame(JInternalFrame f); 65 /** Generally, remove this frame from it's parent and add an iconic representation. */ 66 void iconifyFrame(JInternalFrame f); 67 /** Generally, remove any iconic representation that is present and restore the 68 * frame to it's original size and location. 69 */ 70 void deiconifyFrame(JInternalFrame f); 71 72 /** 73 * Generally, indicate that this frame has focus. This is usually called after 74 * the JInternalFrame's IS_SELECTED_PROPERTY has been set to true. 75 */ 76 void activateFrame(JInternalFrame f); 77 78 /** 79 * Generally, indicate that this frame has lost focus. This is usually called 80 * after the JInternalFrame's IS_SELECTED_PROPERTY has been set to false. 81 */ 82 void deactivateFrame(JInternalFrame f); 83 84 /** This method is normally called when the user has indicated that 85 * they will begin dragging a component around. This method should be called 86 * prior to any dragFrame() calls to allow the DesktopManager to prepare any 87 * necessary state. Normally <b>f</b> will be a JInternalFrame. 88 */ 89 void beginDraggingFrame(JComponent f); 90 91 /** The user has moved the frame. Calls to this method will be preceded by calls 92 * to beginDraggingFrame(). 93 * Normally <b>f</b> will be a JInternalFrame. 94 */ 95 void dragFrame(JComponent f, int newX, int newY); 96 /** This method signals the end of the dragging session. Any state maintained by 97 * the DesktopManager can be removed here. Normally <b>f</b> will be a JInternalFrame. 98 */ 99 void endDraggingFrame(JComponent f); 100 101 /** This methods is normally called when the user has indicated that 102 * they will begin resizing the frame. This method should be called 103 * prior to any resizeFrame() calls to allow the DesktopManager to prepare any 104 * necessary state. Normally <b>f</b> will be a JInternalFrame. 105 */ 106 void beginResizingFrame(JComponent f, int direction); 107 /** The user has resized the component. Calls to this method will be preceded by calls 108 * to beginResizingFrame(). 109 * Normally <b>f</b> will be a JInternalFrame. 110 */ 111 void resizeFrame(JComponent f, int newX, int newY, int newWidth, int newHeight); 112 /** This method signals the end of the resize session. Any state maintained by 113 * the DesktopManager can be removed here. Normally <b>f</b> will be a JInternalFrame. 114 */ 115 void endResizingFrame(JComponent f); 116 117 /** This is a primitive reshape method.*/ 118 void setBoundsForFrame(JComponent f, int newX, int newY, int newWidth, int newHeight); 119 }