strokes.criterions
Class FlickCriterion

java.lang.Object
  extended by strokes.listeners.StrokeAdapter
      extended by strokes.criterions.FlickCriterion
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener, Criterion, StrokeListener

public class FlickCriterion
extends StrokeAdapter
implements java.awt.event.ActionListener, Criterion

A criterion that accepts strokes only during 1 second after a small mouse drag.

Author:
Caroline Appert

Constructor Summary
FlickCriterion(javax.swing.JComponent component, StrokeShortcuts manager)
          Builds a FlickCriterion.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          
 boolean cancelStroke(java.awt.event.MouseEvent event)
          This method is called each time a mouse drag occurs once a stroke has begun.
 boolean startStroke(java.awt.event.MouseEvent event)
          This method is called each time a mouse press occurs on its associated component.
 void strokeNotRecognized(StrokeEvent event)
          Invoked when a stroke ends and has not been recognized as a shortcut.
 void strokePointAdded(StrokeEvent event)
          Invoked when a point is added to a stroke.
 
Methods inherited from class strokes.listeners.StrokeAdapter
shortcutRecognized, strokeBegun, strokeRecognized
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FlickCriterion

public FlickCriterion(javax.swing.JComponent component,
                      StrokeShortcuts manager)
Builds a FlickCriterion.

Parameters:
component - The component on which strokes occur
manager - The stroke shortcuts manager
Method Detail

startStroke

public boolean startStroke(java.awt.event.MouseEvent event)
This method is called each time a mouse press occurs on its associated component.

Specified by:
startStroke in interface Criterion
Parameters:
event - The mouse press event
Returns:
True if this mouse press event must initiate a stroke.

cancelStroke

public boolean cancelStroke(java.awt.event.MouseEvent event)
This method is called each time a mouse drag occurs once a stroke has begun.

Specified by:
cancelStroke in interface Criterion
Parameters:
event - The mouse drag event
Returns:
True if the stroke must be canceled.

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)

Specified by:
actionPerformed in interface java.awt.event.ActionListener

strokeNotRecognized

public void strokeNotRecognized(StrokeEvent event)
Invoked when a stroke ends and has not been recognized as a shortcut.

Specified by:
strokeNotRecognized in interface StrokeListener
Overrides:
strokeNotRecognized in class StrokeAdapter
Parameters:
event - The stroke event.

strokePointAdded

public void strokePointAdded(StrokeEvent event)
Invoked when a point is added to a stroke.

Specified by:
strokePointAdded in interface StrokeListener
Overrides:
strokePointAdded in class StrokeAdapter
Parameters:
event - The stroke event.