import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.applet.Applet;
public class FormattingSelector extends Applet implements ActionListener
{
    //TO DO: Down in ActionPerformed, code the buttons so they work.

    //I can code each button in one line.
    //I suspect that you can code plain, bold and italics in 3 lines.
    //I suspect that you can code change in 4 lines.

    JTextField font, size, red, green, blue;
    JLabel output;

    public void init ()
    {
	resize (500, 500);
	output = new JLabel ("Change the font of this text!");
	output.setPreferredSize (new Dimension (500, 70));
	output.setHorizontalAlignment (0);
	JLabel pmt = new JLabel ("Enter the font (eg Arial):");
	font = new JTextField (10);
	JLabel pmt2 = new JLabel ("Enter the size (eg 12):");
	size = new JTextField (4);
	JButton bold = new JButton ("Bold");
	bold.setActionCommand ("bold");
	bold.addActionListener (this);
	JButton italic = new JButton ("Italics");
	italic.setActionCommand ("italics");
	italic.addActionListener (this);
	JButton plain = new JButton ("Plain");
	plain.setActionCommand ("plain");
	plain.addActionListener (this);
	JLabel spacer = new JLabel ("");
	spacer.setPreferredSize (new Dimension (500, 1));
	JLabel spacer2 = new JLabel ("");
	spacer2.setPreferredSize (new Dimension (500, 1));
	JLabel spacer3 = new JLabel ("");
	spacer3.setPreferredSize (new Dimension (500, 10));
	JLabel spacer4 = new JLabel ("");
	spacer4.setPreferredSize (new Dimension (500, 70));
	JLabel title = new JLabel ("Change the background colour of the applet.");
	title.setPreferredSize (new Dimension (500, 70));
	title.setHorizontalAlignment (0);
	JLabel pmt3 = new JLabel ("Red (0-255): ");
	red = new JTextField (4);
	JLabel pmt4 = new JLabel ("Green (0-255): ");
	green = new JTextField (4);
	JLabel pmt5 = new JLabel ("Blue (0-255): ");
	blue = new JTextField (4);
	JButton change = new JButton ("Change Background");
	change.setActionCommand ("change");
	change.addActionListener (this);
	JLabel spacer5 = new JLabel ("");
	spacer5.setPreferredSize (new Dimension (500, 1));
	JLabel spacer6 = new JLabel ("");
	spacer6.setPreferredSize (new Dimension (500, 1));
	JLabel spacer7 = new JLabel ("");
	spacer7.setPreferredSize (new Dimension (500, 1));
	JLabel spacer8 = new JLabel ("");
	spacer8.setPreferredSize (new Dimension (500, 10));
	add (output);
	add (spacer);
	add (pmt);
	add (font);
	add (spacer2);
	add (pmt2);
	add (size);
	add (spacer3);
	add (bold);
	add (italic);
	add (plain);
	add (spacer4);
	add (title);
	add (spacer5);
	add (pmt3);
	add (red);
	add (spacer6);
	add (pmt4);
	add (green);
	add (spacer7);
	add (pmt5);
	add (blue);
	add (spacer8);
	add (change);


    }


    public void actionPerformed (ActionEvent e)
    {
	if (e.getActionCommand ().equals ("plain"))
	{
	}
	else if (e.getActionCommand ().equals ("bold"))
	{
	}
	else if (e.getActionCommand ().equals ("italics"))
	{
	}
	else if (e.getActionCommand ().equals ("change"))
	{
	}
    }


    protected static ImageIcon createImageIcon (String path)
    {
	java.net.URL imgURL = FormattingSelector.class.getResource (path);
	if (imgURL != null)
	    return new ImageIcon (imgURL);
	else
	    return null;
    }
}
