FileDocCategorySizeDatePackage
Welcome.javaAPI DocExample1064Sun Feb 22 21:39:24 GMT 2004None

Welcome

public class Welcome extends JComponent
This program displays a simple pre-fab welcome sign.

Fields Summary
Font
f
The font used to display the text
Constructors Summary
public Welcome()
Construct the program

		f = new Font("Helvetica", Font.BOLD, 100);
		setBackground(Color.white);
	
Methods Summary
public java.awt.DimensiongetPreferredSize()
Say how big we'd like to be (value hardcoded for now)

		return new Dimension(700,500);
	
public static voidmain(java.lang.String[] args)
The main program or entry point.

		JFrame f = new JFrame("Welcome");
		f.getContentPane().add(new Welcome());
		f.pack();
		f.setVisible(true);
	
public voidpaint(java.awt.Graphics g)
Do the drawing (called automagically by window system when needed)

		g.setColor(Color.white);
		Dimension d = getSize();
		g.fill3DRect(0, 0, d.width-1, d.height-1, true);
		g.setFont(f);
		g.setColor(Color.red);
		g.drawString("Welcome", 100, 150);
		g.drawString("to",	240, 275);
		g.drawString("Java",	160, 400);