/** * Sextant.java 1.00 96/10/07 Merlin Hughes * * Copyright (c) 1996 Prominence Dot Com, Inc. 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. * * http://prominence.com/ merlin@prominence.com */ import java.awt.*; import java.applet.*; public class Sextant extends Applet { Image image; Frame frame; public void init () { System.out.println ("Sextant Navigator, merlin@prominence.com, http://prominence.com/\n" + "Copyright (c) 1996 Prominence Dot Com, Inc. All Rights Reserved."); String bgcolor = getParameter ("bgcolor"); if (bgcolor != null) { try { setBackground (new Color (Integer.parseInt (bgcolor.substring (1), 16))); } catch (NumberFormatException ex) { System.out.println ("Invalid format for bgcolor: " + bgcolor); } } image = getImage (getDocumentBase (), getParameter ("image", "images/sextant.gif")); } public String getParameter (String param, String def) { String result = getParameter (param); if (result != null) return result; else return def; } public void paint (Graphics g) { if (image != null) { int x = image.getWidth (this), y = image.getHeight (this); g.drawImage (image, (size ().width - x) / 2, (size ().height - y) / 2, this); } } public boolean mouseDown (Event e, int x, int y) { if (frame == null) { showStatus ("Loading..."); try { frame = (Frame) Class.forName ("Navigator").newInstance (); } catch (ClassNotFoundException ex) { System.out.println (ex); } catch (InstantiationException ex) { System.out.println (ex); } catch (IllegalAccessException ex) { System.out.println (ex); } frame.postEvent (new Event (frame, -1, this)); frame.pack (); } frame.show (); return super.mouseDown (e, x, y); } public void stop () { if (frame != null) frame.hide (); } }