home *** CD-ROM | disk | FTP | other *** search
Java Source | 2000-06-23 | 2.1 KB | 68 lines |
- /*
- * QuickTime for Java SDK Sample Code
-
- Usage subject to restrictions in SDK License Agreement
- * Copyright: © 1996-1999 Apple Computer, Inc.
-
- */
- import quicktime.app.display.*;
- import quicktime.app.actions.*;
- import java.awt.event.*;
- import quicktime.app.image.*;
- import quicktime.*;
-
- public class LayerChanger extends MouseResponder {
- /**
- * Set some parameters that will create DragActions.
- * @param modifierKeyMask - if specified will determine which modifier keys must
- * be depressed for the action to be invoked.
- */
- public LayerChanger (int modifierKeyMask) {
- this (modifierKeyMask, MouseResponder.kModifiersExactMatch, MouseResponder.kClickEvents);
- }
-
- /**
- * Set some parameters that will create DragActions.
- * @param modifierKeyMask - if specified will determine which modifier keys must
- * be depressed for the action to be invoked.
- * @param modifierTestConditions the test conditions under which the modifier mask is tested
- */
- public LayerChanger (int modifierKeyMask, int modifierTestConditions, int eventInvoker) {
- super (modifierKeyMask, modifierTestConditions, eventInvoker);
- }
- //____________________________ INSTANCE VARIABLES
- private Layerable current;
- private QTDisplaySpace group;
-
- //____________________________ INSTANCE METHODS
- // This will throw a ClassCastException if the Space is incorrect
- // it is called by the MouseController constructor and thus if this cast
- // fails then the controller won't be constructed.
- protected void setTargetSpace (Object space) {
- group = (QTDisplaySpace)space;
- }
-
- protected void setTarget (Object t) {
- current = group.getLayerable(t);
- }
-
- protected void removeTarget () {
- current = null;
- }
-
- public boolean isAppropriate (Object object) {
- return true;
- }
-
- public void mouseClicked (MouseEvent e) {
- try {
- int layer = group.getBackLayer();
- current.setLayer (layer+1);
- } catch (QTException ex) {
- throw new QTRuntimeException (ex);
- } finally {
- current = null; //we've finished with this event might as well drop it
- }
- }
- }
-