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

📄 dockedtabcontainer.java

📁 eq跨平台查询工具源码 eq跨平台查询工具源码
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
                break;        }        return null;    }        /**     * Adds the specified listener to all tabbed panes within     * this component to notify of tab events.     *     * @param the tab listener     */    public void addDockedTabListener(DockedTabDragListener listener) {        if (listeners == null) {            listeners = new ArrayList<DockedTabDragListener>();        }        listeners.add(listener);    }    /**     * Propagates a tab drag event to registered      * listeners of this type.     *     * @param the drag event     */    protected void dockedTabDragged(DockedDragEvent e) {        if (listeners == null || listeners.size() == 0) {            return;        }        for (int i = 0, k = listeners.size(); i < k; i++) {            listeners.get(i).dockedTabDragged(e);        }        desktopMediator.fireDockedTabDragged(e);    }    /**     * Propagates a tab released event to registered      * listeners of this type.     *     * @param the drag event     */    protected void dockedTabReleased(DockedDragEvent e) {        if (listeners == null || listeners.size() == 0) {            return;        }        for (int i = 0, k = listeners.size(); i < k; i++) {            listeners.get(i).dockedTabReleased(e);        }        desktopMediator.fireDockedTabReleased(e);    }    /**      * Returns this panel's orientation (position).     *     * @return the orientation/position of this component     */    public int getOrientation() {        return orientation;    }    protected int getTabPanePosition(DockedTabPane tabPane) {        if (tabPane == northTabPane) {            if (orientation == SwingConstants.WEST) {                return SwingConstants.NORTH_WEST;            } else {                return SwingConstants.NORTH_EAST;            }        }        else if (tabPane == southTabPane) {            if (orientation == SwingConstants.WEST) {                return SwingConstants.SOUTH_WEST;            } else if (orientation == SwingConstants.CENTER) {                return SwingConstants.SOUTH;            } else {                return SwingConstants.SOUTH_EAST;            }        }        return SwingConstants.NORTH_WEST; // default    }        /**     * Overrides here to return an appropriate size     * depneding on orinetation/position and visibility     * of the minimised buttons panel.     *     * @return this components preferred size     */    public Dimension getPreferredSize() {        if (buttonPanel == null) {            return new Dimension(splitPane.getWidth(), getHeight());        } else {            if (orientation == SwingConstants.CENTER) {                return new Dimension(getWidth(), buttonPanel.getHeight());            } else {                return new Dimension(buttonPanel.getWidth(), getHeight());            }        }    }        /**      * Returns the width of this pane.     *     * @return the pane width     */    public int getPaneWidth() {        if (buttonPanel == null) {            return getWidth();        }        else if (splitPane != null) {            return splitPane.getWidth() + buttonPanel.getWidth();        }        return getWidth();    }    /**     * Adds the specified component as a docked tab component     * in the specified position.     *     * @param the tab title     * @param the tab icon     * @param the component     * @param the tab's tool tip     * @param the position - one of SwingConstants.NORTH | SOUTH     */    public void addDockedTab(String title, Icon icon, Component component,                              String tip, int position) {        // make sure the split pane is visible        splitPane.setVisible(true);        DockedTabPane tabPane = null;        // check if we have a north tab pane.        // if not, add there regardless of specified position        if (northTabPane == null && orientation != CENTER) {            northTabPane = new DockedTabPane(this);            splitPane.setLeftComponent(northTabPane);            tabPane = northTabPane;                        // if we have minimised tabs but added a tab pane            // restore it to its previous size            //if (buttonPanel != null) {                //desktopMediator.resetPaneToPreferredSizes(orientation, true);            //}        }        else {                        switch (position) {                case SwingConstants.NORTH:                case SwingConstants.NORTH_WEST:                case SwingConstants.NORTH_EAST:                    tabPane = northTabPane;                    break;                case SwingConstants.SOUTH:                case SwingConstants.SOUTH_WEST:                case SwingConstants.SOUTH_EAST:                    if (southTabPane == null) {                        southTabPane = new DockedTabPane(this);                        southPaneCreated();                    }                    tabPane = southTabPane;                    break;                case SwingConstants.CENTER:                    if (scrollingTabPane == null) {                        scrollingTabPane = new ScrollingTabPane(this);                        splitPane.setLeftComponent(scrollingTabPane);                        splitPane.setGlassPaneVisible(SwingUtilities.BOTTOM, true);                        splitPane.setGlassPaneVisible(SwingUtilities.TOP, false);                        splitPane.setResizeWeight(1.0);                        if (southTabPane != null) {                            splitPane.setDividerSize(                                    ApplicationConstants.SPLIT_PANE_DIVIDER_SIZE);                        }                    }                    scrollingTabPane.addTab(position, title, icon, component, tip);                    return;            }        }        if (tabPane != null) {            tabPane.addTab(position, title, icon, component, tip);        }        if (orientation != SwingConstants.CENTER) {            desktopMediator.resetPaneToPreferredSizes(orientation, true);        }            }    /**     * Sets the tool tip for the specified component to toolTipText      * which can be null. An internal exception is raised if there      * is no tab for the specified component.     *     * @param the tab pane position     * @param the component where the tool tip should be set     * @param the tool tip text to be displayed in the tab     */    public void setToolTipTextForComponent(int position,                                           Component component, String toolTipText) {        switch (position) {            case SwingConstants.NORTH:            case SwingConstants.NORTH_WEST:            case SwingConstants.NORTH_EAST:                northTabPane.setToolTipTextForComponent(component, toolTipText);                break;            case SwingConstants.SOUTH:            case SwingConstants.SOUTH_WEST:            case SwingConstants.SOUTH_EAST:                southTabPane.setToolTipTextForComponent(component, toolTipText);                break;            case SwingConstants.CENTER:                scrollingTabPane.setToolTipTextForComponent(component, toolTipText);                break;        }    }        /**     * Sets the title of the specified component to title which can be null.      * An internal exception is raised if there is no tab for the      * specified component.     *     * @param the tab pane position     * @param the component where the title should be set     * @param the title to be displayed in the tab     */    public void setTabTitleForComponent(int position,                                         Component component, String title) {        switch (position) {            case SwingConstants.NORTH:            case SwingConstants.NORTH_WEST:            case SwingConstants.NORTH_EAST:                northTabPane.setTabTitleForComponent(component, title);                break;            case SwingConstants.SOUTH:            case SwingConstants.SOUTH_WEST:            case SwingConstants.SOUTH_EAST:                southTabPane.setTabTitleForComponent(component, title);                break;            case SwingConstants.CENTER:                scrollingTabPane.setTabTitleForComponent(component, title);                break;        }    }    public void setSelectedIndex(int position, int index) {        switch (position) {            case SwingConstants.NORTH:            case SwingConstants.NORTH_WEST:            case SwingConstants.NORTH_EAST:                northTabPane.setSelectedIndex(index);                break;            case SwingConstants.SOUTH:            case SwingConstants.SOUTH_WEST:            case SwingConstants.SOUTH_EAST:                southTabPane.setSelectedIndex(index);                break;            case SwingConstants.CENTER:                scrollingTabPane.setSelectedIndex(index);                break;        }            }        public int getSelectedIndex(int position) {        switch (position) {            case SwingConstants.NORTH:            case SwingConstants.NORTH_WEST:            case SwingConstants.NORTH_EAST:                return northTabPane.getSelectedIndex();            case SwingConstants.SOUTH:            case SwingConstants.SOUTH_WEST:            case SwingConstants.SOUTH_EAST:                return southTabPane.getSelectedIndex();            case SwingConstants.CENTER:                return scrollingTabPane.getSelectedIndex();        }        return -1;    }        public void setSelectedPane(int position, String name) {        TabComponent tabComponent = getTabComponent(position, name);        if (tabComponent == null) {            return;        }                switch (position) {            case SwingConstants.NORTH:            case SwingConstants.NORTH_WEST:            case SwingConstants.NORTH_EAST:                northTabPane.setSelectedTab(tabComponent);                break;            case SwingConstants.SOUTH:            case SwingConstants.SOUTH_WEST:            case SwingConstants.SOUTH_EAST:                southTabPane.setSelectedTab(tabComponent);                break;            case SwingConstants.CENTER:                scrollingTabPane.setSelectedTab(tabComponent);                break;        }    }        /**     * Returns the open tab count at the specified position.     *     * @param the tab pane position     * @return the tab count     */    public int getTabCount(int position) {        switch (position) {            case SwingConstants.NORTH:            case SwingConstants.NORTH_WEST:            case SwingConstants.NORTH_EAST:                if (northTabPane != null) {                    return northTabPane.getTabCount();                }                break;            case SwingConstants.SOUTH:            case SwingConstants.SOUTH_WEST:            case SwingConstants.SOUTH_EAST:                if (southTabPane != null) {                    return southTabPane.getTabCount();                }                break;            case SwingConstants.CENTER:                if (scrollingTabPane != null) {                    return scrollingTabPane.getTabCount();                }                break;        }        return 0;    }    /**     * Returns the open tab components in a list at      * the specified position.     *     * @param the tab pane position     * @return a list of tab components     */    public List<TabComponent> getOpenTabs(int position) {        switch (position) {            case SwingConstants.NORTH:            case SwingConstants.NORTH_WEST:            case SwingConstants.NORTH_EAST:                if (northTabPane != null) {                    return northTabPane.getTabComponents();                }                break;            case SwingConstants.SOUTH:            case SwingConstants.SOUTH_WEST:            case SwingConstants.SOUTH_EAST:                if (southTabPane != null) {                    return southTabPane.getTabComponents();                }                break;            case SwingConstants.CENTER:                if (scrollingTabPane != null) {                    return scrollingTabPane.getTabComponents();                }                break;        }        return null;    }    public TabComponent getTabComponent(int position, String title) {        List<TabComponent> components = null;        switch (position) {            case SwingConstants.NORTH:            case SwingConstants.NORTH_WEST:            case SwingConstants.NORTH_EAST:                if (northTabPane != null) {                    components = northTabPane.getTabComponents();                }                break;            case SwingConstants.SOUTH:            case SwingConstants.SOUTH_WEST:            case SwingConstants.SOUTH_EAST:                if (southTabPane != null) {                    components = southTabPane.getTabComponents();                }                break;            case SwingConstants.CENTER:                if (scrollingTabPane != null) {                    components = scrollingTabPane.getTabComponents();                }                break;        }        

⌨️ 快捷键说明

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