import java.applet.*;
import java.awt.*;

public class ShowFonts extends Applet
{
	public ShowFonts()
	{
	}

	public String getAppletInfo()
	{
		return "Name: ShowFonts\r\n" +
		       "Author: Brian Jahns\r\n" +
		       "Created with Microsoft Visual J++ Version 1.1";
	}


	public void init()
	{
		Frame f=new NewFrame("The ShowFonts Applet");
		MenuBar mb=new MenuBar();
		f.setMenuBar(mb);

		Menu m =new Menu("Font");
		m.add("TimesRoman");
		m.add("-");
		m.add("Arial");
		m.add("-");
		m.add("Courier");
		mb.add(m);

		Menu c =new Menu("Color");
		c.add("Green");
		c.add("-");
		c.add("Black");
		c.add("-");
		c.add("Yellow");
		mb.add(c);

		f.resize(600, 250);

		f.show();
	}

	public void destroy()
	{
	}

	public void start()
	{
	}
	
	public void stop()
	{
	}
}



//
//
//NewFrame
//
//
class NewFrame extends Frame
{
	Menu m, c;
	int col=0;
	Font fnt=new Font("TimesRoman",Font.BOLD,15);
	String label="TimesRoman";
	NewFrame(String title)
	{
		super(title);
	}
	public boolean action(Event evt, Object arg)
	{
		if(evt.target instanceof MenuItem)
		{
				label=(String)arg;
				if(label.equals("TimesRoman"))
					fnt=new Font("TimesRoman",Font.BOLD,25);
				else if(label.equals("Arial"))
					fnt=new Font("Arial",Font.BOLD,25);
				else if(label.equals("Courier"))
					fnt=new Font("Courier",Font.BOLD,25);
	
				if(label.equals("Green"))
					col=1;
				else if(label.equals("Black"))
					col=2;
				else if (label.equals("Yellow"))
					col=3;
				repaint();
				return true;
		}
		else return false;
	}

	public void paint(Graphics g)
	{
		g.setFont(fnt);
		if(col==0)
			g.setColor(Color.magenta);
		if(col==1)
			g.setColor(Color.green);
		if(col==2)
			g.setColor(Color.black);
		if(col==3)
			g.setColor(Color.yellow);
		g.drawString("This is the "+label+" selected by VV",30,80);
	}
}