home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 2.toast / pc / sample code / quicktime / quicktime for java / slideshow / src / slideshow.java next >
Encoding:
Java Source  |  2000-06-23  |  1.6 KB  |  56 lines

  1. /*
  2.  * QuickTime for Java SDK Sample Code
  3.  
  4.    Usage subject to restrictions in SDK License Agreement
  5.  * Copyright: © 1996-1999 Apple Computer, Inc.
  6.  
  7.  */
  8. import java.awt.event.*;
  9. import java.awt.*;
  10.  
  11. import quicktime.*;
  12. import quicktime.app.image.*;
  13. import quicktime.app.display.*;
  14.  
  15. public class SlideShow extends ImageViewer implements MouseListener {
  16. //_________________________ CLASS METHODS
  17.     public SlideShow (ImageSequencer images) throws QTException {
  18.         super (images);
  19.     }
  20. //_________________________ INSTANCE METHODS
  21.     /**
  22.      * This method is called when a Drawable object is added to a canvas.
  23.      * @param obj the QTCanvas that the drawable object is being added to.
  24.      */
  25.     public void addedTo (Object obj) {
  26.         ((Component)obj).addMouseListener (this);
  27.     }
  28.  
  29.     /**
  30.      * This method is called when a Drawable object is removed a canvas.
  31.      * @param obj the QTCanvas that the drawable object is being removed from.
  32.      */
  33.     public void removedFrom (Object obj) {
  34.         ((Component)obj).removeMouseListener (this);
  35.     }
  36.  
  37. // this would be a good place to put a transition
  38.     /** Mouse pressed events are used to change the current image */
  39.     public void mousePressed (MouseEvent ev) {
  40.         if ((ev.getModifiers() & InputEvent.ALT_MASK) != 0) {
  41.             getImages().setFramePrevious();
  42.         } else {
  43.             getImages().setFrameNext();
  44.         }
  45.         try {
  46.             setDisplayedImage (getImages().getImage(), getImages().getDescription());
  47.         } catch (QTException e) { e.printStackTrace(); }
  48.     }
  49.  
  50.     public void mouseClicked (MouseEvent e) {}
  51.     public void mouseEntered (MouseEvent e) {}
  52.     public void mouseExited (MouseEvent e) {}
  53.     public void mouseReleased (MouseEvent e) {}
  54. }
  55.  
  56.