FileDocCategorySizeDatePackage
MetalSeparatorUI.javaAPI DocJava SE 5 API2088Fri Aug 26 14:58:08 BST 2005javax.swing.plaf.metal

MetalSeparatorUI

public class MetalSeparatorUI extends BasicSeparatorUI
A Metal L&F implementation of SeparatorUI. This implementation is a "combined" view/controller.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see {@link java.beans.XMLEncoder}.

version
1.16 12/19/03
author
Jeff Shapiro

Fields Summary
Constructors Summary
Methods Summary
public static javax.swing.plaf.ComponentUIcreateUI(javax.swing.JComponent c)

        return new MetalSeparatorUI();
    
public java.awt.DimensiongetPreferredSize(javax.swing.JComponent c)

 
	if ( ((JSeparator)c).getOrientation() == JSeparator.VERTICAL )
	    return new Dimension( 2, 0 );
	else
	    return new Dimension( 0, 2 );
    
protected voidinstallDefaults(javax.swing.JSeparator s)

        LookAndFeel.installColors( s, "Separator.background", "Separator.foreground" );
    
public voidpaint(java.awt.Graphics g, javax.swing.JComponent c)

        Dimension s = c.getSize();

	if ( ((JSeparator)c).getOrientation() == JSeparator.VERTICAL )
	{
	  g.setColor( c.getForeground() );
	  g.drawLine( 0, 0, 0, s.height );

	  g.setColor( c.getBackground() );
	  g.drawLine( 1, 0, 1, s.height );
	}
	else  // HORIZONTAL
	{
	  g.setColor( c.getForeground() );
	  g.drawLine( 0, 0, s.width, 0 );

	  g.setColor( c.getBackground() );
	  g.drawLine( 0, 1, s.width, 1 );
	}