/** * ColorTestSwatch draws samples of all system color instances.<p> * * Copyright &copy; 1997 Martin Minow. All Rights Reserved.<p> * * Permission to use, copy, modify, and redistribute this software and its * documentation for personal, non-commercial use is hereby granted provided that * this copyright notice and appropriate documentation appears in all copies. This * software may not be distributed for fee or as part of commercial, "shareware," * and/or not-for-profit endevors including, but not limited to, CD-ROM collections, * online databases, and subscription services without specific license.<p> * * @author <a href="mailto:minow@apple.com">Martin Minow</a> * @version 1.0 * Set tabs every 4 characters. */import java.util.*;import java.awt.*;/* * This class requires Java 1.1 */class ColorTestSwatch extends Canvas{	SystemColor			color;		public ColorTestSwatch(			SystemColor	color		)	{		this.color		= color;	}	public void update(			Graphics	g		)	{		paint(g);	}	public void paint(			Graphics	g		)	{		Dimension size	= size();		int				x	= (size.width - ColorTestDialog.colorWidth - 2) / 2;		int				y	= (size.height - ColorTestDialog.colorWidth - 2) / 2;		g.setColor(Color.black);		g.drawRect(x, y,				ColorTestDialog.colorWidth + 3,				ColorTestDialog.colorWidth + 3			);		g.setColor(color);		/* *** Bug: always black	*** */		g.fillRect(x + 2, y + 2,				ColorTestDialog.colorWidth,				ColorTestDialog.colorWidth			);	}	public Dimension getPreferredSize()	{		return (new Dimension(					ColorTestDialog.colorWidth + 5,					ColorTestDialog.colorWidth + 5				));	}	public Dimension getMinimumSize()	{		return (getPreferredSize());	}}