View Javadoc
1 /* 2 * JScroll - the scrollable desktop pane for Java. 3 * Copyright (C) 2003 Tom Tessier 4 * 5 * This program is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU General Public License 7 * as published by the Free Software Foundation; either version 2 8 * of the License, or (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program; if not, write to the Free Software 17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 * 19 */ 20 21 package org.jscroll.widgets; 22 23 import javax.swing.*; 24 25 import java.awt.*; 26 27 28 /*** 29 * This class provides a custom desktop pane. 30 * The drag mode is set to 31 * {@link javax.swing.JDesktopPane#OUTLINE_DRAG_MODE outline} 32 * by default, the desktop manager is 33 * set to {@link org.jscroll.widgets.JScrollDesktopManager 34 * JScrollDesktopManager}, and the look and feel DesktopIconUI is 35 * replaced by the blank icon generator, 36 * {@link org.jscroll.widgets.EmptyDesktopIconUI EmptyDesktopIconUI}. 37 * 38 * @author <a href="mailto:tessier@gabinternet.com">Tom Tessier</a> 39 * @version 1.0 9-Aug-2001 40 */ 41 public class RootDesktopPane extends JDesktopPane { 42 private DesktopScrollPane desktopScrollpane; 43 44 /*** 45 * creates the RootDesktopPane 46 * 47 * @param desktopScrollpane a reference to DesktopScrollPane 48 */ 49 public RootDesktopPane(DesktopScrollPane desktopScrollpane) { 50 this.desktopScrollpane = desktopScrollpane; 51 52 // setup the UIManager to replace the look and feel DesktopIconUI 53 // with an empty one (EmptyDesktopIconUI) so that the desktop icon 54 // for the internal frame is not painted 55 // (ie: when internal frame iconified...) 56 UIDefaults defaults = UIManager.getDefaults(); 57 defaults.put("DesktopIconUI", 58 getClass().getPackage().getName() + ".EmptyDesktopIconUI"); 59 60 // set up some defaults 61 setDesktopManager(new JScrollDesktopManager(this)); 62 63 // pre-1.3 code (has no effect in JFC implementations before Swing 1.1.1 Beta 1) 64 // putClientProperty("JDesktopPane.dragMode", "outline"); 65 // 66 // replace the following line with the above to execute under JDK 1.2 67 setDragMode(JDesktopPane.OUTLINE_DRAG_MODE); 68 } 69 70 /*** 71 * returns the view rectangle associated with the 72 * {@link org.jscroll.widgets.DesktopScrollPane DesktopScrollPane} 73 * viewport 74 * 75 * @return the Rectangle object of the viewport 76 */ 77 public Rectangle getScrollPaneRectangle() { 78 return desktopScrollpane.getViewport().getViewRect(); 79 } 80 81 /*** 82 * propogates the removeAssociatedComponents() call to 83 * {@link org.jscroll.widgets.DesktopScrollPane DesktopScrollPane} 84 * 85 * @param f the internal frame whose associated components 86 * are to be removed 87 */ 88 public void removeAssociatedComponents(JScrollInternalFrame f) { 89 desktopScrollpane.removeAssociatedComponents(f); 90 } 91 92 /*** 93 * propogates the resizeDesktop() call to 94 * {@link org.jscroll.widgets.DesktopScrollPane DesktopScrollPane} 95 */ 96 public void resizeDesktop() { 97 desktopScrollpane.resizeDesktop(); 98 } 99 }

This page was automatically generated by Maven