///////////////////////////////////////////////////////// // Module AboutDialog.java // Version 1.0 // Language Java // Author Sudhakar Chandrasekaran (thaths@netscape.com) // History // 04/17/97 Modified for version 2.0 // 04/20/97 Minor positioning modifications // 01/04/97 Created // // Legalese // Copyright (C) 1996-1997 Sudhakar Chandrasekharan // // This program is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by the // Free Software Foundation; either version 2 of the license, or (at your // option) any later version. // // This program is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. Writers of free software // cannot afford getting sued! // // You should have received a copy of the GNU General Public License along // with this program; if not, write to the Free Software Foundation, Inc., // 675 Mass Ave., Cambridge, MA 02139, USA. // // Sudhakar "Thaths" Chandrasekharan, 20 April 1997. //////////////////////////////////////////////////////// import java.awt.*; class AboutDialog extends Dialog { LogoCanvas logoCanvas; // We will paint our logo on this canvas // Constructor AboutDialog(Frame f) { super(f, true); setLayout(new BorderLayout()); // Now Draw the logo logoCanvas = new LogoCanvas(); add("Center", logoCanvas); Panel buttonPanel = new Panel(); buttonPanel.setLayout(new FlowLayout(FlowLayout.CENTER)); buttonPanel.add(new Button("OK")); buttonPanel.validate(); add("South", buttonPanel); validate(); resize(300,200); show(); } // Event handler // If the 'OK' button was clicked, dispose() // this dialog public boolean action(Event evt, Object onWhat) { if(evt.target instanceof Button) { String label = (String) onWhat; if (label.equals("OK")) { dispose(); return true; } } return super.handleEvent(evt); } } // The canvas on which we draw the logo class LogoCanvas extends Canvas { // Constructor LogoCanvas() { setBackground(new Color(255,255,255)); } // Here is where we actually paint all // the stuff on the canvas public void paint(Graphics g) { Dimension d = size(); Color bg = getBackground(); g.setColor(new Color(0,0,255)); // Draw a nice 3-D box around the canvas g.draw3DRect(0,0,d.width-2,d.height-2,true); g.draw3DRect(2,2,d.width-5,d.height-5,false); Font fnt = new Font("Times Roman", Font.BOLD, 15); FontMetrics fm = g.getFontMetrics(); g.setFont(fnt); g.setColor(new Color(0,192,255)); String logo = new String("Client Search v2.0"); g.drawString(logo,75,25); g.setColor(new Color(255,0,192)); fnt = new Font("Times Roman", Font.PLAIN, 9); fm = g.getFontMetrics(); g.setFont(fnt); String sublogo1 = new String("Copyright (C), 1996-97"); g.drawString(sublogo1,90,50); String sublogo2 = new String("Sudhakar 'Thaths' Chandrasekharan"); g.drawString(sublogo2,71,65); g.setColor(new Color(0,0,255)); String sublogo3 = new String("http://www.aunet.org/thaths/hacks/ClientSearch/"); g.drawString(sublogo3,50,80); } // The minimum size for the canvas // Should not be using all those constant numbers public Dimension minimumSize() { Dimension d = new Dimension(250,150); return d; } // Would prefer if the canvas of this // size public Dimension preferredSize() { Dimension d = new Dimension(250,150); return d; } }