FileDocCategorySizeDatePackage
DropShadow.javaAPI DocExample2449Sun Feb 08 21:33:48 GMT 2004None

DropShadow

public class DropShadow extends Applet
DropShadow -- show overlapped painting.
author
Copyright 1995, 1997 Ian F. Darwin, http://www.darwinsys.com/, http://www.darwinsys.com.
version
$Id: DropShadow.java,v 1.6 2004/02/09 03:33:48 ian Exp $

Fields Summary
protected String
theLabel
The label that is to appear in the window
protected int
width
The width and height
protected int
height
protected String
fontName
The name of the font
protected Font
theFont
The font
protected int
fontSize
The size of the font
protected int
theOffset
The offset for the drop shadow
protected boolean
inittedOK
True if we got all required parameters
Constructors Summary
Methods Summary
public java.lang.String[][]getParameterInfo()
Give Parameter info to the AppletViewer, just for those writing HTML without hardcopy documentation :-)

		String info[][] = {
			{ "label",		"string",	"Text to display" },
			{ "fontname",	"name",		"Font to display it in" },
			{ "fontsize",	"10-30?",	"Size to display it at" },
		};
		return info;
	
public voidinit()
Called from the browser to set up. We want to throw various kinds of exceptions but the API predefines that we don't, so we limit ourselves to the ubiquitous IllegalArgumentException.


	                              	 
	   
		// System.out.println("In DropShadow init()");

		theLabel = getParameter("label");
		if (theLabel == null)
				throw new IllegalArgumentException("LABEL is REQUIRED");
		// Now handle font stuff.
		fontName = getParameter("fontname");
		if (fontName == null)
				throw new IllegalArgumentException("FONTNAME is REQUIRED");
		String s;
		if ((s = getParameter("fontsize")) != null)
			fontSize = Integer.parseInt(s);
		if (fontName != null || fontSize != 0) {
			theFont = new Font(fontName, Font.BOLD + Font.ITALIC, fontSize);
			System.out.println("Name " + fontName + ", font " + theFont);
		}
		if ((s = getParameter("offset")) != null)
			theOffset = Integer.parseInt(s);
		setBackground(Color.green);
		inittedOK = true;
	
public voidpaint(java.awt.Graphics g)
Paint method showing drop shadow effect

		if (!inittedOK)
			return;
		g.setFont(theFont);
		g.setColor(Color.black);
		g.drawString(theLabel, theOffset+30, theOffset+50);
		g.setColor(Color.white);
		g.drawString(theLabel, 30, 50);