⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 basicdockpanel.java

📁 openmap java写的开源数字地图程序. 用applet实现,可以像google map 那样放大缩小地图.
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
// **********************************************************************// // <copyright>// //  BBN Technologies//  10 Moulton Street//  Cambridge, MA 02138//  (617) 873-8000// //  Copyright (C) BBNT Solutions LLC. All rights reserved.// // </copyright>// **********************************************************************// // $Source: /cvs/distapps/openmap/src/openmap/com/bbn/openmap/gui/dock/BasicDockPanel.java,v $// $RCSfile: BasicDockPanel.java,v $// $Revision: 1.2.2.2 $// $Date: 2005/08/09 17:59:30 $// $Author: dietrick $// // **********************************************************************package com.bbn.openmap.gui.dock;import java.awt.Component;import javax.swing.*;import java.util.*;import com.bbn.openmap.util.Debug;/** * A component that has a background component and docking children. *  * @author Ben Lubin * @version $Revision: 1.2.2.2 $ on $Date: 2005/08/09 17:59:30 $ * @since 12/5/02 */public class BasicDockPanel extends JLayeredPane implements DockPanel {    /** Layer where we add the background component */    private static final Integer BACKGROUND_LAYER = new Integer(-100);    /** The one and only background component */    private JComponent background;    /** Maps children to their constraint objects */    private HashMap childToConstraint = new HashMap(11);    /**     * Maps children to their wrappers (not 1-to-1 when tabbing     * involved)     */    private HashMap childToWrapper = new HashMap(11);    /** A list of wrappers that are currently wrapped in JFrames */    private List externalFrameWrappers = new ArrayList(0);    /** A list of wrappers that are currently loose InternalFrames */    private List internalFrameWrappers = new ArrayList(0);    /**     * Invisible root dock wrapper, that will be pegged to the edge of     * the panel.     */    private DockWrapper north = new DockWrapper(this, DockWrapper.DOCK_NORTH);    /**     * Invisible root dock wrapper, that will be pegged to the edge of     * the panel.     */    private DockWrapper south = new DockWrapper(this, DockWrapper.DOCK_SOUTH);    /**     * Invisible root dock wrapper, that will be pegged to the edge of     * the panel.     */    private DockWrapper east = new DockWrapper(this, DockWrapper.DOCK_EAST);    /**     * Invisible root dock wrapper, that will be pegged to the edge of     * the panel.     */    private DockWrapper west = new DockWrapper(this, DockWrapper.DOCK_WEST);    public BasicDockPanel() {        super();        setLayout(new DockLayout(this));        setBackground(UIManager.getColor("control"));    }    //Background Methods:    /////////////////////    public JComponent getBackgroundComponent() {        return background;    }    public void setBackgroundComponent(JComponent back) {        if (getBackgroundComponent() != null) {            remove(getBackgroundComponent());        }        add(back, BACKGROUND);    }    //Constraint Methods:    /////////////////////    public void setConstraint(JComponent child, DockConstraint c) {        childToConstraint.put(child, c);    }    public DockConstraint getConstraint(JComponent child) {        return (DockConstraint) childToConstraint.get(child);    }    public void removeConstraint(JComponent child) {        childToConstraint.remove(child);    }    //Constraint Setup Functions:    /////////////////////////////    public void setPreferredHeight(JComponent child, int i) {        DockWrapper dw = getWrapper(child);        if (dw != null) {            dw.setPreferredHeight(i);        }    }    public void setPreferredWidth(JComponent child, int i) {        DockWrapper dw = getWrapper(child);        if (dw != null) {            dw.setPreferredWidth(i);        }    }    public void setCanOcclude(JComponent child, boolean b) {        getConstraint(child).setCanOcclude(b);    }    public void setCanTransparent(JComponent child, boolean b) {        getConstraint(child).setCanTransparent(b);        DockWrapper dw = getWrapper(child);        if (dw != null) {            dw.updateTransparency();        }    }    public void setCanResize(JComponent child, boolean b) {        getConstraint(child).setCanResize(b);        DockWrapper dw = getWrapper(child);        if (dw != null) {            dw.updateResizable();        }    }    public void setCanTab(JComponent child, boolean b) {        getConstraint(child).setCanTab(b);        dockSomewhere(child);    }    /**     * Set the name of the tab to use when the component is tabbed (if     * it can tab). If unspecified, defaults to Component.getName()     */    public void setTabName(JComponent child, String tabName) {        getConstraint(child).setTabName(tabName);        getWrapper(child).setTabName(child, tabName);    }    public void setCanExternalFrame(JComponent child, boolean b) {        getConstraint(child).setCanExternalFrame(b);        dockSomewhere(child);    }    public void setCanInternalFrame(JComponent child, boolean b) {        getConstraint(child).setCanInternalFrame(b);        dockSomewhere(child);    }    public void setCanClose(JComponent child, boolean b) {        getConstraint(child).setCanClose(b);    }    public void setCanDockNorth(JComponent child, boolean b) {        getConstraint(child).setCanDockNorth(b);        dockSomewhere(child);    }    public void setCanDockSouth(JComponent child, boolean b) {        getConstraint(child).setCanDockSouth(b);        dockSomewhere(child);    }    public void setCanDockEast(JComponent child, boolean b) {        getConstraint(child).setCanDockEast(b);        dockSomewhere(child);    }    public void setCanDockWest(JComponent child, boolean b) {        getConstraint(child).setCanDockWest(b);        dockSomewhere(child);    }    //Docking Functions:    ////////////////////    public void dockNorth(JComponent child) {        dockNorth(child, -1);    }    public void dockNorth(JComponent child, int idx) {        dockNorth(getWrapper(child), idx);    }    protected void dockNorth(DockWrapper wrapper) {        dockNorth(wrapper, -1);    }    /**     * Dock the given child into the given position on the MapPanel     */    protected void dockNorth(DockWrapper wrapper, int idx) {        dock(north, wrapper, idx);    }    public void dockSouth(JComponent child) {        dockSouth(child, -1);    }    public void dockSouth(JComponent child, int idx) {        dockSouth(getWrapper(child), idx);    }    protected void dockSouth(DockWrapper wrapper) {        dockSouth(wrapper, -1);    }    /**     * Dock the given child into the given position on the MapPanel     */    protected void dockSouth(DockWrapper wrapper, int idx) {        dock(south, wrapper, idx);    }    public void dockEast(JComponent child) {        dockEast(child, -1);    }    public void dockEast(JComponent child, int idx) {        dockEast(getWrapper(child), idx);    }    protected void dockEast(DockWrapper wrapper) {        dockEast(wrapper, -1);    }    /**     * Dock the given child into the given position on the MapPanel     */    protected void dockEast(DockWrapper wrapper, int idx) {        dock(east, wrapper, idx);    }    public void dockWest(JComponent child) {        dockWest(child, -1);    }    public void dockWest(JComponent child, int idx) {        dockWest(getWrapper(child), idx);    }    protected void dockWest(DockWrapper wrapper) {        dockWest(wrapper, -1);    }    /**     * Dock the given child into the given position on the MapPanel     */    protected void dockWest(DockWrapper wrapper, int idx) {        dock(west, wrapper, idx);    }    /**     * Dock the given child onto the given parent, which is itself a     * child of this class.     */    public void dock(JComponent outter, JComponent inner) {        dock(outter, inner, -1);    }    /**     * Dock the given child onto the given parent, which is itself a     * child of this class.     */    public void dock(JComponent outter, JComponent inner, int idx) {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -