Home -> Workshops -> STA 2000 Java Workshop -> ConverterApplet class

Class ConverterApplet

Copy all into Editor and save as ConverterApplet.java:

import java.awt.*;
import java.awt.event.*;
import java.applet.Applet;

public class ConverterApplet extends Applet implements ActionListener
{	private Converter converter = null;
	private Button start = new Button("Start");

	public void init()
	{	setLayout(new BorderLayout());
		add("South", start);
		start.addActionListener(this);
	}
	public void closeFrame()
	{	if (converter != null)
		{	converter.hide();
			converter.dispose();
			converter = null;
		}
	}
	public void actionPerformed(ActionEvent ae)
	{	if (ae.getSource() == start)
		{	if (converter == null)
				converter = new Converter(this);
			else
				converter.toFront();
		}
	}
}