home *** CD-ROM | disk | FTP | other *** search
Java Source | 1999-10-02 | 2.4 KB | 85 lines |
- /*
- * @(#)GIFletViewer.java 1999/09/28
- *
- * Copyright (c) 1999, David Griffiths. All Rights Reserved.
- *
- * This software is the proprietary information of David Griffiths.
- * This source code may not be published or redistributed without the
- * express permission of the author.
- *
- * THE AUTHOR MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY
- * OF THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
- * PURPOSE, OR NON-INFRINGEMENT. THE AUTHOR SHALL NOT BE LIABLE FOR ANY DAMAGES
- * SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING
- * THIS SOFTWARE OR ITS DERIVATIVES.
- */
-
- /**
- * GIFletViewer is a wrapper class that is used to display the
- * GIFLake applet.
- * @version 1.0 1999/09/28
- * @author David Griffiths
- */
-
- import java.util.Hashtable;
- import java.io.*;
- import java.awt.*;
- import java.awt.event.*;
-
- public class GIFletViewer {
- public int width, height;
- private Frame frm;
- private Button btnSave;
- private GIFLake gif1;
-
- public static void main (String[] args) {
- GIFletViewer g = new GIFletViewer();
- g.init(args);
- }
-
- private void loadImage() {
- Toolkit t = Toolkit.getDefaultToolkit();
- Image img1 = t.getImage("logo.gif");
- MediaTracker mediaTracker = new MediaTracker(frm);
- mediaTracker.addImage(img1, 1);
- try {
- mediaTracker.waitForID(1);
- frm.setSize(img1.getWidth(frm), btnSave.getSize().height + img1.getHeight(frm) * 18 / 10);
- gif1.setSize(img1.getWidth(frm), img1.getHeight(frm) * 18 / 10);
- btnSave.setSize(img1.getWidth(frm), btnSave.getSize().height);
- gif1.setImage(img1);
- gif1.start();
- }
- catch (InterruptedException e) {
- }
- }
-
- public void init(String[] args) {
- frm = new Frame();
- frm.setLayout(new BorderLayout());
- frm.setSize(100, 600);
- frm.setTitle("Spigots.com GIFletViewer");
- gif1 = new GIFLake();
- frm.add("Center", gif1);
- frm.addWindowListener(new WindowAdapter() {
- public void windowClosing(WindowEvent e) {
- System.exit(0);
- }
- public void windowOpened(WindowEvent e) {
- loadImage();
- }
- });
- btnSave = new Button("Capture Animation");
- btnSave.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- btnSave.setEnabled(false);
- gif1.startCapture();
- btnSave.setEnabled(true);
- }
- });
- frm.add("North", btnSave);
- frm.show();
- }
- }
-