/* * Copyright (c) 1997, 1998 Subrahmanyam Allamaraju. All Rights Reserved. * * Permission to use, copy, modify, and distribute this software for * NON-COMMERCIAL purposes and without fee is hereby granted provided that this * copyright notice appears in all copies. * * This software is intended for demonstration purposes only, and comes without * any explicit or implicit warranty. * * Send all queries about this product to subrahmanyam@geocities.com * */ import java.applet.*; import java.awt.*; import java.awt.event.*; public class TableApp extends Applet implements ActionListener { // The Demo frame. TableFrame f; // The buttons. Button start, stop; public void init() { start = new Button("Start the Demo"); stop = new Button("Stop the Demo"); Label l0 = new Label("Welcome to the Demo"); Label l1 = new Label("Author: Subrahmanyam Allamaraju"); Label l2 = new Label("Mail comments to: sallamar@cvimail.cv.com"); Label l3 = new Label("Copyright 1997, 1998 All rights reserved."); add(l0); add(l1); add(l2); add(l3); add(start); add(stop); start.addActionListener(this); stop.addActionListener(this); } // Handle button clicks here. public void actionPerformed(ActionEvent e) { if(e.getSource() == start) { if(f == null) { f = new TableFrame(this, "TableDemo"); } f.pack(); f.setVisible(true); } else if(e.getSource() == stop) { if(f != null) { f.setVisible(false); f.dispose(); f = null; } } } // Make sure that the frame is disposed when the browser loads another page. public void stop() { if(f != null) { f.setVisible(false); f.dispose(); f = null; } } public void paint(Graphics g) { Dimension d = getSize(); Color bg = getBackground(); g.setColor(bg); g.draw3DRect(0, 0, d.width - 1, d.height - 1, false); g.draw3DRect(3, 3, d.width - 7, d.height - 7, true); } }