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

📄 metaliconfactory.java

📁 java jdk 1.4的源码
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
		}		else {		    g.drawLine(4, 7, 7, 7);		    g.drawLine(4, 8, 7, 8);		}	    }	    else {	        g.drawLine( xoff + 7, 12, xoff + 7, 15 );		g.drawLine( xoff + 8, 12, xoff + 8, 15 );		//	g.setColor( c.getBackground() );		//	g.drawLine( xoff + 7, 16, xoff + 8, 16 );	    }	    // Draw Fill	    g.setColor( MetalLookAndFeel.getPrimaryControlDarkShadow() );	    g.drawLine( xoff + 5, 6, xoff + 5, 9 );      // left shadow	    g.drawLine( xoff + 6, 5, xoff + 9, 5 );      // top shadow	    g.setColor( MetalLookAndFeel.getPrimaryControlShadow() );	    g.drawLine( xoff + 6, 6, xoff + 6, 6 );      // top left fill	    g.drawLine( xoff + 9, 6, xoff + 9, 6 );      // top right fill	    g.drawLine( xoff + 6, 9, xoff + 6, 9 );      // bottom left fill	    g.drawLine( xoff + 10, 6, xoff + 10, 9 );    // right fill	    g.drawLine( xoff + 6, 10, xoff + 9, 10 );    // bottom fill	    g.setColor( MetalLookAndFeel.getPrimaryControl() );	    g.drawLine( xoff + 6, 7, xoff + 6, 8 );      // left highlight	    g.drawLine( xoff + 7, 6, xoff + 8, 6 );      // top highlight	    g.drawLine( xoff + 9, 7, xoff + 9, 7 );      // right highlight	    g.drawLine( xoff + 7, 9, xoff + 7, 9 );      // bottom highlight	    g.setColor( MetalLookAndFeel.getPrimaryControlHighlight() );	    g.drawLine( xoff + 8, 9, xoff + 9, 9 );	    g.drawLine( xoff + 9, 8, xoff + 9, 8 );	}	public int getIconWidth() { return treeControlSize.width; }	public int getIconHeight() { return treeControlSize.height; }    }  //  // Menu Icons  //    static private final Dimension menuArrowIconSize = new Dimension( 4, 8 );    static private final Dimension menuCheckIconSize = new Dimension( 10, 10 );    static private final int xOff = 4;    private static class MenuArrowIcon implements Icon, UIResource, Serializable    {	public void paintIcon( Component c, Graphics g, int x, int y )	{	    JMenuItem b = (JMenuItem) c;	    ButtonModel model = b.getModel();	    g.translate( x, y );	    if ( !model.isEnabled() )	    {	        g.setColor( MetalLookAndFeel.getMenuDisabledForeground() );	    }	    else	    {	        if ( model.isArmed() || ( c instanceof JMenu && model.isSelected() ) )		{		    g.setColor( MetalLookAndFeel.getMenuSelectedForeground() );		}		else		{		    g.setColor( b.getForeground() );		}	    }            if( MetalUtils.isLeftToRight(b) ) {                g.drawLine( 0, 0, 0, 7 );                g.drawLine( 1, 1, 1, 6 );                g.drawLine( 2, 2, 2, 5 );                g.drawLine( 3, 3, 3, 4 );            } else {                g.drawLine( 4, 0, 4, 7 );                g.drawLine( 3, 1, 3, 6 );                g.drawLine( 2, 2, 2, 5 );                g.drawLine( 1, 3, 1, 4 );            }	    g.translate( -x, -y );	}	public int getIconWidth() { return menuArrowIconSize.width; }	public int getIconHeight() { return menuArrowIconSize.height; }    } // End class MenuArrowIcon    private static class MenuItemArrowIcon implements Icon, UIResource, Serializable    {	public void paintIcon( Component c, Graphics g, int x, int y )	{	}	public int getIconWidth() { return menuArrowIconSize.width; }	public int getIconHeight() { return menuArrowIconSize.height; }    } // End class MenuItemArrowIcon    private static class CheckBoxMenuItemIcon implements Icon, UIResource, Serializable    {	public void paintIcon( Component c, Graphics g, int x, int y )	{	    JMenuItem b = (JMenuItem) c;	    ButtonModel model = b.getModel();	    boolean isSelected = model.isSelected();	    boolean isEnabled = model.isEnabled();	    boolean isPressed = model.isPressed();	    boolean isArmed = model.isArmed();	    	    g.translate( x, y );	    if ( isEnabled )	    {	        if ( isPressed || isArmed )		{		    g.setColor( MetalLookAndFeel.getControlInfo()  );		    g.drawLine( 0, 0, 8, 0 );		    g.drawLine( 0, 0, 0, 8 );		    g.drawLine( 8, 2, 8, 8 );		    g.drawLine( 2, 8, 8, 8 );		    g.setColor( MetalLookAndFeel.getPrimaryControl()  );		    g.drawLine( 1, 1, 7, 1 );		    g.drawLine( 1, 1, 1, 7 );		    g.drawLine( 9, 1, 9, 9 );		    g.drawLine( 1, 9, 9, 9 );		}		else		{		    g.setColor( MetalLookAndFeel.getControlDarkShadow()  );		    g.drawLine( 0, 0, 8, 0 );		    g.drawLine( 0, 0, 0, 8 );		    g.drawLine( 8, 2, 8, 8 );		    g.drawLine( 2, 8, 8, 8 );		    g.setColor( MetalLookAndFeel.getControlHighlight()  );		    g.drawLine( 1, 1, 7, 1 );		    g.drawLine( 1, 1, 1, 7 );		    g.drawLine( 9, 1, 9, 9 );		    g.drawLine( 1, 9, 9, 9 );		}	    }	    else	    {	        g.setColor( MetalLookAndFeel.getMenuDisabledForeground()  );		g.drawRect( 0, 0, 8, 8 );	    }	    if ( isSelected )	    {	        if ( isEnabled )		{		    if ( model.isArmed() || ( c instanceof JMenu && model.isSelected() ) )		    {		        g.setColor( MetalLookAndFeel.getMenuSelectedForeground() );		    }		    else		    {		        g.setColor( b.getForeground() );		    }		}		else		{		    g.setColor( MetalLookAndFeel.getMenuDisabledForeground()  );		}		g.drawLine( 2, 2, 2, 6 );		g.drawLine( 3, 2, 3, 6 );		g.drawLine( 4, 4, 8, 0 );		g.drawLine( 4, 5, 9, 0 );	    }	    g.translate( -x, -y );	}	public int getIconWidth() { return menuCheckIconSize.width; }	public int getIconHeight() { return menuCheckIconSize.height; }    }  // End class CheckBoxMenuItemIcon    private static class RadioButtonMenuItemIcon implements Icon, UIResource, Serializable    {	public void paintIcon( Component c, Graphics g, int x, int y )	{	    JMenuItem b = (JMenuItem) c;	    ButtonModel model = b.getModel();	    boolean isSelected = model.isSelected();	    boolean isEnabled = model.isEnabled();	    boolean isPressed = model.isPressed();	    boolean isArmed = model.isArmed();	    	    g.translate( x, y );	    if ( isEnabled )	    {	        if ( isPressed || isArmed )		{		    g.setColor( MetalLookAndFeel.getPrimaryControl()  );		    g.drawLine( 3, 1, 8, 1 );		    g.drawLine( 2, 9, 7, 9 );		    g.drawLine( 1, 3, 1, 8 );		    g.drawLine( 9, 2, 9, 7 );		    g.drawLine( 2, 2, 2, 2 );		    g.drawLine( 8, 8, 8, 8 );		    g.setColor( MetalLookAndFeel.getControlInfo()  );		    g.drawLine( 2, 0, 6, 0 );		    g.drawLine( 2, 8, 6, 8 );		    g.drawLine( 0, 2, 0, 6 );		    g.drawLine( 8, 2, 8, 6 );		    g.drawLine( 1, 1, 1, 1 );		    g.drawLine( 7, 1, 7, 1 );		    g.drawLine( 1, 7, 1, 7 );		    g.drawLine( 7, 7, 7, 7 );		}		else		{		    g.setColor( MetalLookAndFeel.getControlHighlight()  );		    g.drawLine( 3, 1, 8, 1 );		    g.drawLine( 2, 9, 7, 9 );		    g.drawLine( 1, 3, 1, 8 );		    g.drawLine( 9, 2, 9, 7 );		    g.drawLine( 2, 2, 2, 2 );		    g.drawLine( 8, 8, 8, 8 );		    g.setColor( MetalLookAndFeel.getControlDarkShadow()  );		    g.drawLine( 2, 0, 6, 0 );		    g.drawLine( 2, 8, 6, 8 );		    g.drawLine( 0, 2, 0, 6 );		    g.drawLine( 8, 2, 8, 6 );		    g.drawLine( 1, 1, 1, 1 );		    g.drawLine( 7, 1, 7, 1 );		    g.drawLine( 1, 7, 1, 7 );		    g.drawLine( 7, 7, 7, 7 );		}	    }	    else	    {	        g.setColor( MetalLookAndFeel.getMenuDisabledForeground()  );		g.drawLine( 2, 0, 6, 0 );		g.drawLine( 2, 8, 6, 8 );		g.drawLine( 0, 2, 0, 6 );		g.drawLine( 8, 2, 8, 6 );		g.drawLine( 1, 1, 1, 1 );		g.drawLine( 7, 1, 7, 1 );		g.drawLine( 1, 7, 1, 7 );		g.drawLine( 7, 7, 7, 7 );	    }	    if ( isSelected )	    {	        if ( isEnabled )		{		    if ( model.isArmed() || ( c instanceof JMenu && model.isSelected() ) )		    {		        g.setColor( MetalLookAndFeel.getMenuSelectedForeground() );		    }		    else		    {		        g.setColor( b.getForeground() );		    }		}		else		{		    g.setColor( MetalLookAndFeel.getMenuDisabledForeground()  );		}		g.drawLine( 3, 2, 5, 2 );		g.drawLine( 2, 3, 6, 3 );		g.drawLine( 2, 4, 6, 4 );		g.drawLine( 2, 5, 6, 5 );		g.drawLine( 3, 6, 5, 6 );	    }	    g.translate( -x, -y );	}	public int getIconWidth() { return menuCheckIconSize.width; }	public int getIconHeight() { return menuCheckIconSize.height; }    }  // End class RadioButtonMenuItemIconprivate static class VerticalSliderThumbIcon implements Icon, Serializable, UIResource {    protected static MetalBumps controlBumps;    protected static MetalBumps primaryBumps;    public VerticalSliderThumbIcon() {        controlBumps = new MetalBumps( 6, 10,				MetalLookAndFeel.getControlHighlight(),				MetalLookAndFeel.getControlInfo(),				MetalLookAndFeel.getControl() );                primaryBumps = new MetalBumps( 6, 10,				MetalLookAndFeel.getPrimaryControl(),				MetalLookAndFeel.getPrimaryControlDarkShadow(),				MetalLookAndFeel.getPrimaryControlShadow() );            }    public void paintIcon( Component c, Graphics g, int x, int y ) {        JSlider slider = (JSlider)c;	boolean leftToRight = MetalUtils.isLeftToRight(slider);        g.translate( x, y );	// Draw the frame	if ( slider.hasFocus() ) {	    g.setColor( MetalLookAndFeel.getPrimaryControlInfo() );	}	else {	    g.setColor( slider.isEnabled() ? MetalLookAndFeel.getPrimaryControlInfo() :			                     MetalLookAndFeel.getControlDarkShadow() );	}	if (leftToRight) {	    g.drawLine(  1,0  ,  8,0  ); // top	    g.drawLine(  0,1  ,  0,13 ); // left	    g.drawLine(  1,14 ,  8,14 ); // bottom	    g.drawLine(  9,1  , 15,7  ); // top slant	    g.drawLine(  9,13 , 15,7  ); // bottom slant	}	else {	    g.drawLine(  7,0  , 14,0  ); // top	    g.drawLine( 15,1  , 15,13 ); // right	    g.drawLine(  7,14 , 14,14 ); // bottom	    g.drawLine(  0,7  ,  6,1  ); // top slant	    g.drawLine(  0,7  ,  6,13 ); // bottom slant	}	// Fill in the background	if ( slider.hasFocus() ) {	    g.setColor( c.getForeground() );	}	else {	    g.setColor( MetalLookAndFeel.getControl() );	}	if (leftToRight) {	    g.fillRect(  1,1 ,  8,13 );	    g.drawLine(  9,2 ,  9,12 );	    g.drawLine( 10,3 , 10,11 );	    g.drawLine( 11,4 , 11,10 );	    g.drawLine( 12,5 , 12,9 );	    g.drawLine( 13,6 , 13,8 );	    g.drawLine( 14,7 , 14,7 );	}	else {	    g.fillRect(  7,1,   8,13 );	    g.drawLine(  6,3 ,  6,12 );	    g.drawLine(  5,4 ,  5,11 );	    g.drawLine(  4,5 ,  4,10 );	    g.drawLine(  3,6 ,  3,9 );	    g.drawLine(  2,7 ,  2,8 );	}	// Draw the bumps	int offset = (leftToRight) ? 2 : 8;	if ( slider.isEnabled() ) {	    if ( slider.hasFocus() ) {	        primaryBumps.paintIcon( c, g, offset, 2 );	    }	    else {	        controlBumps.paintIcon( c, g, offset, 2 );	    }	}	// Draw the highlight	if ( slider.isEnabled() ) {	    g.setColor( slider.hasFocus() ? MetalLookAndFeel.getPrimaryControl()			: MetalLookAndFeel.getControlHighlight() );	    if (leftToRight) {	        g.drawLine( 1, 1, 8, 1 );		g.drawLine( 1, 1, 1, 13 );	    }	    else {	        g.drawLine(  8,1  , 14,1  ); // top		g.drawLine(  1,7  ,  7,1  ); // top slant	    }	}        g.translate( -x, -y );    }    public int getIconWidth() {        return 16;    }    public int getIconHeight() {        return 15;    }}private static class HorizontalSliderThumbIcon implements Icon, Serializable, UIResource {    protected static MetalBumps controlBumps;    protected static MetalBumps primaryBumps;    public HorizontalSliderThumbIcon() {        controlBumps = new MetalBumps( 10, 6,				MetalLookAndFeel.getControlHighlight(),				MetalLookAndFeel.getControlInfo(),				MetalLookAndFee

⌨️ 快捷键说明

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