import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import org.suman.awt.*;

/* A demo applet that showcases my org.suman.awt classes */
public final class Matrix extends Applet implements ActionListener {

/* The window */
Frame f;

public void init() {
// add button
	Button b = new Button("Click here to start the demo");
	b.addActionListener(this);
	add(b);
}

// clicking on the button brings up the window	
public void actionPerformed(ActionEvent e) {
	f = new Frame("Demo of org.suman.awt classes");
	f.setSize(600, 450);

	f.setBackground(Color.black);
	f.setLayout(new GridLayout(1,1));
	Image bck = getImage(getCodeBase(), "matrix.gif");
// add ImagePanel
	ImagePanel p = new ImagePanel(bck);
	f.add(p);

	GridBagLayout gridbag = new GridBagLayout();
	GridBagConstraints c = new GridBagConstraints();
	p.setLayout(gridbag);

	c.gridwidth = c.REMAINDER;
	c.weighty = 2;

/* Add a 3D Label with the text "The Matrix") */
	Label3D l3d = new Label3D("The Matrix");
	l3d.setFont(new Font("Serif", Font.BOLD, 48));
	l3d.setForeground(Color.red);
	l3d.setBackground(new Color(100, 100, 100));
	gridbag.setConstraints(l3d, c);
	p.add(l3d);

/* Add an ArcButton */
	ArcButton ebutt = new ArcButton("This is a cool ArcButton!");
/*	ebutt.addActionListener(this); */
	gridbag.setConstraints(ebutt, c);
	p.add(ebutt);

/* Add a HyperImage */
	HyperImage ehi = new HyperImage(
		getImage(getCodeBase(), "ad2.gif"), "My Home Page");
/*	ehi.addActionListener(this); */
	gridbag.setConstraints(ehi, c);
	p.add(ehi);

// Hyperlink
	HyperLink l = new HyperLink("Go to Sun's Java Tutorial!");
	l.setForeground(Color.lightGray);
/*	l.addActionListener(this); */
	gridbag.setConstraints(l, c);
	p.add(l);

	f.setVisible(true);
	f.addWindowListener(new WindowAdapter() {
		public void windowClosing(WindowEvent e) {
			f.setVisible(false);
		}	
	});
}

} /* End class */
