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

📄 metaltabbedpaneui.java

📁 Mobile 应用程序使用 Java Micro Edition (Java ME) 平台
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
            g.setColor( darkShadow );        }        // Paint slant        g.drawLine( 1, 5, 6, 0 );        // Paint top        g.drawLine( 6, 0, right, 0 );        // Paint bottom        if ( tabIndex == lastIndex ) {            g.drawLine( 0, bottom, right, bottom );        }        // Paint left        if (ocean) {            if (tabPane.getSelectedIndex() == tabIndex - 1) {                g.drawLine(0, 5, 0, bottom);                g.setColor(oceanSelectedBorderColor);                g.drawLine(0, 0, 0, 5);            }            else if (isSelected) {                g.drawLine( 0, 6, 0, bottom );                if (tabIndex != 0) {                    g.setColor(darkShadow);                    g.drawLine(0, 0, 0, 5);                }            }            else if ( tabIndex != firstIndex ) {                g.drawLine( 0, 0, 0, bottom );            } else {                g.drawLine( 0, 6, 0, bottom );            }        }        else { // metal            if ( tabIndex != firstIndex ) {                g.drawLine( 0, 0, 0, bottom );            } else {                g.drawLine( 0, 6, 0, bottom );            }        }        g.translate( -x, -y );    }    protected void paintBottomTabBorder( int tabIndex, Graphics g,                                          int x, int y, int w, int h,                                         int btm, int rght,                                         boolean isSelected ) {        int tabCount = tabPane.getTabCount();        int currentRun = getRunForTab( tabCount, tabIndex );        int lastIndex = lastTabInRun( tabCount, currentRun );        int firstIndex = tabRuns[ currentRun ];	boolean leftToRight = MetalUtils.isLeftToRight(tabPane);        int bottom = h - 1;        int right = w - 1;        //        // Paint Gap        //        if ( shouldFillGap( currentRun, tabIndex, x, y ) ) {            g.translate( x, y );	    if ( leftToRight ) {	        g.setColor( getColorForGap( currentRun, x, y ) );		g.fillRect( 1, bottom - 4, 3, 5 );		g.fillRect( 4, bottom - 1, 2, 2 );	    } else {	        g.setColor( getColorForGap( currentRun, x + w - 1, y ) );		g.fillRect( right - 3, bottom - 3, 3, 4 );		g.fillRect( right - 5, bottom - 1, 2, 2 );		g.drawLine( right - 1, bottom - 4, right - 1, bottom - 4 );	    }            g.translate( -x, -y );        }        g.translate( x, y );        //        // Paint Border        //        if (ocean && isSelected) {            g.setColor(oceanSelectedBorderColor);        }        else {            g.setColor( darkShadow );        }	if ( leftToRight ) {	    // Paint slant	    g.drawLine( 1, bottom - 5, 6, bottom );	    // Paint bottom	    g.drawLine( 6, bottom, right, bottom );	    // Paint right	    if ( tabIndex == lastIndex ) {	        g.drawLine( right, 0, right, bottom );	    }	    // Paint left            if (ocean && isSelected) {                g.drawLine(0, 0, 0, bottom - 6);                if ((currentRun == 0 && tabIndex != 0) ||                    (currentRun > 0 && tabIndex != tabRuns[currentRun - 1])) {                    g.setColor(darkShadow);                    g.drawLine(0, bottom - 5, 0, bottom);                }            }            else {                if (ocean && tabIndex == tabPane.getSelectedIndex() + 1) {                    g.setColor(oceanSelectedBorderColor);                }                if ( tabIndex != tabRuns[ runCount - 1 ] ) {                    g.drawLine( 0, 0, 0, bottom );                } else {                    g.drawLine( 0, 0, 0, bottom - 6 );                }            }	} else {	    // Paint slant	    g.drawLine( right - 1, bottom - 5, right - 6, bottom );	    // Paint bottom	    g.drawLine( right - 6, bottom, 0, bottom );	    // Paint left	    if ( tabIndex==lastIndex ) {	        // last tab in run	        g.drawLine( 0, 0, 0, bottom );	    }	    // Paint right            if (ocean && tabIndex == tabPane.getSelectedIndex() + 1) {                g.setColor(oceanSelectedBorderColor);                g.drawLine(right, 0, right, bottom);            }            else if (ocean && isSelected) {                g.drawLine(right, 0, right, bottom - 6);                if (tabIndex != firstIndex) {                    g.setColor(darkShadow);                    g.drawLine(right, bottom - 5, right, bottom);                }            }	    else if ( tabIndex != tabRuns[ runCount - 1 ] ) {	        // not the first tab in the last run	        g.drawLine( right, 0, right, bottom );	    } else {	        // the first tab in the last run	        g.drawLine( right, 0, right, bottom - 6 );	    }	}        //        // Paint Highlight        //        g.setColor( isSelected ? selectHighlight : highlight );	if ( leftToRight ) {	    // Paint slant	    g.drawLine( 1, bottom - 6, 6, bottom - 1 );	    // Paint left	    g.drawLine( 1, 0, 1, bottom - 6 );	    // paint highlight in the gap on tab behind this one	    // on the left end (where they all line up)	    if ( tabIndex==firstIndex && tabIndex!=tabRuns[runCount - 1] ) {	        //  first tab in run but not first tab in last run	        if (tabPane.getSelectedIndex()==tabRuns[currentRun+1]) {		    // tab in front of selected tab		    g.setColor( selectHighlight );		}		else {		    // tab in front of normal tab		    g.setColor( highlight );		}		g.drawLine( 1, bottom - 4, 1, bottom );	    }	} else {	    // Paint left	    if ( tabIndex==lastIndex ) {	        // last tab in run	        g.drawLine( 1, 0, 1, bottom - 1 );	    } else {	        g.drawLine( 0, 0, 0, bottom - 1 );	    }	}        g.translate( -x, -y );    }    protected void paintRightTabBorder( int tabIndex, Graphics g,                                         int x, int y, int w, int h,                                        int btm, int rght,                                        boolean isSelected ) {        int tabCount = tabPane.getTabCount();        int currentRun = getRunForTab( tabCount, tabIndex );        int lastIndex = lastTabInRun( tabCount, currentRun );        int firstIndex = tabRuns[ currentRun ];        g.translate( x, y );        int bottom = h - 1;        int right = w - 1;        //        // Paint part of the tab above        //        if ( tabIndex != firstIndex && tabsOpaque ) {            g.setColor( tabPane.getSelectedIndex() == tabIndex - 1 ?                        selectColor :                        getUnselectedBackgroundAt( tabIndex - 1 ) );            g.fillRect( right - 5, 0, 5, 3 );            g.fillRect( right - 2, 3, 2, 2 );        }        //        // Paint Highlight        //        g.setColor( isSelected ? selectHighlight : highlight );        // Paint slant        g.drawLine( right - 6, 1, right - 1, 6 );        // Paint top        g.drawLine( 0, 1, right - 6, 1 );        // Paint left	if ( !isSelected ) {	    g.drawLine( 0, 1, 0, bottom );	}        //        // Paint Border        //        if (ocean && isSelected) {            g.setColor(oceanSelectedBorderColor);        }        else {            g.setColor( darkShadow );        }        // Paint bottom        if ( tabIndex == lastIndex ) {            g.drawLine( 0, bottom, right, bottom );        }        // Paint slant        if (ocean && tabPane.getSelectedIndex() == tabIndex - 1) {            g.setColor(oceanSelectedBorderColor);        }        g.drawLine( right - 6, 0, right, 6 );        // Paint top        g.drawLine( 0, 0, right - 6, 0 );        // Paint right        if (ocean && isSelected) {            g.drawLine(right, 6, right, bottom);            if (tabIndex != firstIndex) {                g.setColor(darkShadow);                g.drawLine(right, 0, right, 5);            }        }        else if (ocean && tabPane.getSelectedIndex() == tabIndex - 1) {            g.setColor(oceanSelectedBorderColor);            g.drawLine(right, 0, right, 6);            g.setColor(darkShadow);            g.drawLine(right, 6, right, bottom);        }        else if ( tabIndex != firstIndex ) {            g.drawLine( right, 0, right, bottom );        } else {            g.drawLine( right, 6, right, bottom );        }        g.translate( -x, -y );    }    public void update( Graphics g, JComponent c ) {	if ( c.isOpaque() ) {	    g.setColor( tabAreaBackground );	    g.fillRect( 0, 0, c.getWidth(),c.getHeight() );	}	paint( g, c );    }    protected void paintTabBackground( Graphics g, int tabPlacement,                                       int tabIndex, int x, int y, int w, int h, boolean isSelected ) {        int slantWidth = h / 2;        if ( isSelected ) {            g.setColor( selectColor );        } else {            g.setColor( getUnselectedBackgroundAt( tabIndex ) );        }	if (MetalUtils.isLeftToRight(tabPane)) {	    switch ( tabPlacement ) {                case LEFT:		    g.fillRect( x + 5, y + 1, w - 5, h - 1);		    g.fillRect( x + 2, y + 4, 3, h - 4 );		    break;                case BOTTOM:		    g.fillRect( x + 2, y, w - 2, h - 4 );		    g.fillRect( x + 5, y + (h - 1) - 3, w - 5, 3 );		    break;                case RIGHT:		    g.fillRect( x, y + 2, w - 4, h - 2);		    g.fillRect( x + (w - 1) - 3, y + 5, 3, h - 5 );		    break;                case TOP:                default:		    g.fillRect( x + 4, y + 2, (w - 1) - 3, (h - 1) - 1 );		    g.fillRect( x + 2, y + 5, 2, h - 5 );	    }	} else {	    switch ( tabPlacement ) {                case LEFT:		    g.fillRect( x + 5, y + 1, w - 5, h - 1);		    g.fillRect( x + 2, y + 4, 3, h - 4 );		    break;                case BOTTOM:		    g.fillRect( x, y, w - 5, h - 1 );		    g.fillRect( x + (w - 1) - 4, y, 4, h - 5);		    g.fillRect( x + (w - 1) - 4, y + (h - 1) - 4, 2, 2);		    break;                case RIGHT:		    g.fillRect( x + 1, y + 1, w - 5, h - 1);		    g.fillRect( x + (w - 1) - 3, y + 5, 3, h - 5 );		    break;                case TOP:                default:		    g.fillRect( x, y + 2, (w - 1) - 3, (h - 1) - 1 );		    g.fillRect( x + (w - 1) - 3, y + 5, 3, h - 3 );	    }	}    }    /**     * Overridden to do nothing for the Java L&F.     */    protected int getTabLabelShiftX( int tabPlacement, int tabIndex, boolean isSelected ) {        return 0;     }    /**     * Overridden to do nothing for the Java L&F.     */    protected int getTabLabelShiftY( int tabPlacement, int tabIndex, boolean isSelected ) {        return 0;     }    /**     * {@inheritDoc}     *     * @since 1.6     */    protected int getBaselineOffset() {        return 0;    }    public void paint( Graphics g, JComponent c ) {        int tabPlacement = tabPane.getTabPlacement();        Insets insets = c.getInsets(); Dimension size = c.getSize();        // Paint the background for the tab area        if ( tabPane.isOpaque() ) {            Color bg = UIManager.getColor("TabbedPane.tabAreaBackground");            if (bg != null) {                g.setColor(bg);            }            else {                g.setColor( c.getBackground() );            }            switch ( tabPlacement ) {            case LEFT:                g.fillRect( insets.left, insets.top,                             calculateTabAreaWidth( tabPlacement, runCount, maxTabWidth ),                            size.height - insets.bottom - insets.top );                break;            case BOTTOM:                int totalTabHeight = calculateTabAreaHeight( tabPlacement, runCount, maxTabHeight );                g.fillRect( insets.left, size.height - insets.bottom - totalTabHeight,                             size.width - insets.left - insets.right,                            totalTabHeight );                break;

⌨️ 快捷键说明

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