edu.mit.sketch.toolkit
Class Tablet

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Frame
                          |
                          +--edu.mit.sketch.toolkit.TabletGUI
                                |
                                +--edu.mit.sketch.toolkit.TabletDataProcessor
                                      |
                                      +--edu.mit.sketch.toolkit.TabletGUIBehavior
                                            |
                                            +--edu.mit.sketch.toolkit.Tablet
All Implemented Interfaces:
Accessible, ActionListener, AdjustmentListener, EventListener, ImageObserver, KeyListener, MenuContainer, MouseListener, MouseMotionListener, Serializable

public class Tablet
extends edu.mit.sketch.toolkit.TabletGUIBehavior
implements KeyListener

Acronyms: sdr -> StrokeDataReader, sd -> StrokeData This class handles the updates to various frames.

See Also:
Serialized Form

Inner classes inherited from class java.awt.Frame
Frame.AccessibleAWTFrame
 
Inner classes inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
Inner classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
Component.AccessibleAWTComponent
 
Field Summary
 MenuItem a_menu
           
static double a_scale
           
 Frame a_window
           
 Graphics a_window_graphics
           
static double accumulated_length_scale
           
static StatisticsModule bar_statistics_module
           
static float brush_thickness
           
 BufferedImage buffer
           
 Graphics buffer_graphics
           
 boolean buffer_ready
           
 double circle_vs_general_path_bias
           
 double circle_vs_speed_bias
           
 SimpleClassifier classifier
           
 double combine_treshold
           
 edu.mit.sketch.toolkit.ControlModule control_module
           
 MenuItem controls_menu
           
 MenuItem d_menu
           
static double d_theta_scale
           
 Frame d_window
           
 Graphics d_window_graphics
           
static StrokeData data
          Stroke data
 MenuItem data_menu
           
 JFrame data_window
           
 double dd_dt_average_scale
           
 MenuItem dd_dt_menu
           
 MenuItem dd_dt_scale_space_menu
           
 edu.mit.sketch.toolkit.DirectionChangeScaleSpaceViewer dd_dt_scale_space_viewer
           
 Frame dd_dt_window
           
 Graphics dd_dt_window_graphics
           
static StatisticsModule ddsw_statistics_module
           
static boolean debug
           
static Graphics debug_graphics
           
static boolean debug2
           
 MenuItem derive_snapshots_menu
           
 boolean deriving_scale_space
           
 Vertex[] direction_fit
           
 Menu direction_menu
           
 int direction_window_width
           
 boolean display_lsq_vectors
           
 MenuItem display_menu
           
static StatisticsModule dsw_statistics_module
           
 Menu edit
           
 Menu file
           
 Vertex[] final_fit
           
static int fit_method
           
 MenuItem fits_menu
           
 Frame fits_window
           
 Graphics fits_window_graphics
           
 Color graph_color
           
 boolean in_recognition_mode
           
static Label info_bar
           
 edu.mit.sketch.toolkit.JointDisplay joint_display
           
 MenuItem joint_display_menu
           
 Point[] line
          Parameters and constants.
static double LSQE_treshold
           
 MenuBar menubar
           
 edu.mit.sketch.toolkit.ObjectManager object_manager
           
 MenuItem open_menu
           
 Menu options
           
 double orientation_angle
           
 Menu pen_menu
           
static boolean platform_is_windows9x
           
static boolean platform_is_windowsNT
           
 PolarPoint[] polar_points
           
 Menu processing
           
 MenuItem quit_menu
           
 MenuItem save_as_menu
           
 MenuItem save_menu
           
static edu.mit.sketch.toolkit.StrokeDataReader sdr
          Stroke data reader used for reading and instantiating StrokeData
static long sequence_delay
           
 boolean show_parsed_objects
           
static StatisticsModule sliding_window_statistics_module
           
 double speed_average_scale
           
 Vertex[] speed_fit
           
 MenuItem statistics_menu
           
static Label status_bar
           
static double t_scale
           
 edu.mit.sketch.toolkit.TabletDebugger tablet_debugger
          The debugger
 double test_line_scale
           
static double theta_scale
           
 double turn_angle_treshold
           
 MenuItem undo_menu
           
 MenuItem v_menu
           
static double v_scale
           
 MenuItem v_scale_space_menu
           
 edu.mit.sketch.toolkit.SpeedScaleSpaceViewer v_scale_space_viewer
           
 Frame v_window
           
 Graphics v_window_graphics
           
 MenuItem vectors_menu
           
 boolean vertex_identification
          For painting vertices closest to the cursor.
static double window_width
           
 Menu windows
           
 JList x_list
           
 JList y_list
           
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
Tablet(int max_data_points, double speed_average_scale, String cursor_image_name, boolean platform_is_windows9x, boolean platform_is_windowsNT)
          The constructor.
 
Method Summary
 void actionPerformed(ActionEvent e)
          Handle action events
 void addAllComponentsAsKeyListeners()
          Add Components As Key Listeners
 void addEventListeners()
          add event listeners
 void addPoint(Point p, long t)
          Add a new point to sdr with t as the time stamp.
 void adjustmentValueChanged(AdjustmentEvent e)
          adjustmentValueChanged
 void clearComponent(Component component)
          Clear the component
 void clearScreen()
          Clear screen
 Vertex[] combineEndPoints(Vertex[] polygon)
          Combines the ends of the polygon if they are sufficiently close.
 void constructGUI()
          construct the GUI part of the Tablet.
 void constructToolbar()
          Construct the toolbar
 void convolveChangeInDirection()
          Do convolution.
 void convolveDirection()
          Do convolution.
 void displayFitByIndices(int[] indices)
          displayFitByIndices
 void displayFitByReversedIndices(int[] indices)
          displayFitByIndices
 void displayVertices(Vertex[] vertices)
          Update various graphs and statistics.
 double gauss(double x, double sigma)
           
 long getTimeStamp(MouseEvent e)
          This method is needed only for supporting the rather silly windows9X platform, because it is still using the dos clock.
 void initializeBuffer()
          Overloaded for double buffering.
 void initializeGraphicsObjects()
          initializeGraphicsObjects
 void keyPressed(KeyEvent k)
          Handle key stroke events
 void keyReleased(KeyEvent k)
          Handle key stroke events
 void keyTyped(KeyEvent ke)
          Handle key stroke events
 void mouseClicked(MouseEvent e)
          Handle mouse events
 void mouseDragged(MouseEvent e)
          Handle mouse motion events
 void mouseEntered(MouseEvent e)
          Handle mouse events
 void mouseExited(MouseEvent e)
          Handle mouse events
 void mouseMoved(MouseEvent e)
          Handle mouse motion events
 void mousePressed(MouseEvent e)
          Handle mouse events
 void mouseReleased(MouseEvent e)
          Handle mouse events
 void paint_d(StrokeData data, Color color)
          Update the direction graph.
 void paint_dd_dt(StrokeData data, Color color)
          Update change in direction
 void paint(Graphics g)
          Overloaded for double buffering.
 void paintAcceleration(StrokeData data, Color color)
          Update the acceleration graph.
 void paintFvsG(double[] f, double[] g, Color color, Component component, AffineTransform transform)
          Paint f vs g in the frame using the input color and affine transform.
 void paintFvsG(long[] f, double[] g, Color color, Component component, AffineTransform transform)
          Paint f vs g in the frame using the input color and affine transform.
 void paintVelocity(StrokeData data, Color color)
          Update the velocity graph.
 void reset()
          Reset the arrays
 void setDebugging(boolean d)
          Set debugging mode
 void setFitMehod(int method)
          Change the fit method, rederive the direction and related entities.
static void setInfoMessage(String message)
          Set the status bar label text to the input string.
 void setRecognitionMode(boolean flag)
          Disable or enable recognition process by turning mouse event listening off or on.
static void setStatusMessage(String message)
          Set the status bar label text to the input string.
 Vertex[] simplifyPolygon(Vertex[] input_vertices)
          Simplify the polygon to get rid of consecutive lines which are sufficiently parallel.
 void toggle()
          toggle the state related with showing the parsed objects.
 void update_fits()
          Update the info about the various fits (LSQE etc.)
 void update(Graphics g)
          Update various graphs and statistics.
 void zoomX(double k)
          Zoom in all window's X axis by k
 void zoomY(double k)
          Zoom in all window's y axis by k
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getAccessibleContext, getCursorType, getFrames, getIconImage, getMenuBar, getState, getTitle, isResizable, paramString, remove, removeNotify, setCursor, setIconImage, setMenuBar, setResizable, setState, setTitle
 
Methods inherited from class java.awt.Window
addWindowListener, applyResourceBundle, applyResourceBundle, dispose, getFocusOwner, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getOwnedWindows, getOwner, getToolkit, getWarningString, hide, isShowing, pack, postEvent, processEvent, processWindowEvent, removeWindowListener, setCursor, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, setFont, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

tablet_debugger

public edu.mit.sketch.toolkit.TabletDebugger tablet_debugger
The debugger

vertex_identification

public boolean vertex_identification
For painting vertices closest to the cursor.

a_scale

public static double a_scale

v_scale

public static double v_scale

t_scale

public static double t_scale

theta_scale

public static double theta_scale

d_theta_scale

public static double d_theta_scale

accumulated_length_scale

public static double accumulated_length_scale

brush_thickness

public static float brush_thickness

display_lsq_vectors

public boolean display_lsq_vectors

show_parsed_objects

public boolean show_parsed_objects

buffer_ready

public boolean buffer_ready

buffer

public BufferedImage buffer

buffer_graphics

public Graphics buffer_graphics

v_window_graphics

public Graphics v_window_graphics

a_window_graphics

public Graphics a_window_graphics

d_window_graphics

public Graphics d_window_graphics

fits_window_graphics

public Graphics fits_window_graphics

dd_dt_window_graphics

public Graphics dd_dt_window_graphics

sdr

public static edu.mit.sketch.toolkit.StrokeDataReader sdr
Stroke data reader used for reading and instantiating StrokeData

data

public static StrokeData data
Stroke data

final_fit

public Vertex[] final_fit

speed_fit

public Vertex[] speed_fit

direction_fit

public Vertex[] direction_fit

polar_points

public PolarPoint[] polar_points

direction_window_width

public int direction_window_width

dd_dt_average_scale

public double dd_dt_average_scale

speed_average_scale

public double speed_average_scale

test_line_scale

public double test_line_scale

combine_treshold

public double combine_treshold

orientation_angle

public double orientation_angle

turn_angle_treshold

public double turn_angle_treshold

circle_vs_speed_bias

public double circle_vs_speed_bias

circle_vs_general_path_bias

public double circle_vs_general_path_bias

line

public Point[] line
Parameters and constants.

in_recognition_mode

public boolean in_recognition_mode

deriving_scale_space

public boolean deriving_scale_space

platform_is_windows9x

public static boolean platform_is_windows9x

platform_is_windowsNT

public static boolean platform_is_windowsNT

debug

public static boolean debug

debug2

public static boolean debug2

fit_method

public static int fit_method

window_width

public static double window_width

sequence_delay

public static long sequence_delay

LSQE_treshold

public static double LSQE_treshold

object_manager

public edu.mit.sketch.toolkit.ObjectManager object_manager

control_module

public edu.mit.sketch.toolkit.ControlModule control_module

classifier

public SimpleClassifier classifier

v_window

public Frame v_window

a_window

public Frame a_window

d_window

public Frame d_window

fits_window

public Frame fits_window

dd_dt_window

public Frame dd_dt_window

data_window

public JFrame data_window

joint_display

public edu.mit.sketch.toolkit.JointDisplay joint_display

menubar

public MenuBar menubar

file

public Menu file

open_menu

public MenuItem open_menu

save_menu

public MenuItem save_menu

save_as_menu

public MenuItem save_as_menu

quit_menu

public MenuItem quit_menu

edit

public Menu edit

undo_menu

public MenuItem undo_menu

windows

public Menu windows

v_menu

public MenuItem v_menu

a_menu

public MenuItem a_menu

pen_menu

public Menu pen_menu

direction_menu

public Menu direction_menu

d_menu

public MenuItem d_menu

fits_menu

public MenuItem fits_menu

data_menu

public MenuItem data_menu

dd_dt_menu

public MenuItem dd_dt_menu

controls_menu

public MenuItem controls_menu

statistics_menu

public MenuItem statistics_menu

joint_display_menu

public MenuItem joint_display_menu

v_scale_space_menu

public MenuItem v_scale_space_menu

dd_dt_scale_space_menu

public MenuItem dd_dt_scale_space_menu

options

public Menu options

vectors_menu

public MenuItem vectors_menu

display_menu

public MenuItem display_menu

processing

public Menu processing

derive_snapshots_menu

public MenuItem derive_snapshots_menu

info_bar

public static Label info_bar

status_bar

public static Label status_bar

x_list

public JList x_list

y_list

public JList y_list

debug_graphics

public static Graphics debug_graphics

bar_statistics_module

public static StatisticsModule bar_statistics_module

dsw_statistics_module

public static StatisticsModule dsw_statistics_module

ddsw_statistics_module

public static StatisticsModule ddsw_statistics_module

sliding_window_statistics_module

public static StatisticsModule sliding_window_statistics_module

graph_color

public Color graph_color

v_scale_space_viewer

public edu.mit.sketch.toolkit.SpeedScaleSpaceViewer v_scale_space_viewer

dd_dt_scale_space_viewer

public edu.mit.sketch.toolkit.DirectionChangeScaleSpaceViewer dd_dt_scale_space_viewer
Constructor Detail

Tablet

public Tablet(int max_data_points,
              double speed_average_scale,
              String cursor_image_name,
              boolean platform_is_windows9x,
              boolean platform_is_windowsNT)
The constructor.
Method Detail

addAllComponentsAsKeyListeners

public void addAllComponentsAsKeyListeners()
Add Components As Key Listeners

keyPressed

public void keyPressed(KeyEvent k)
Handle key stroke events
Specified by:
keyPressed in interface KeyListener

keyReleased

public void keyReleased(KeyEvent k)
Handle key stroke events
Specified by:
keyReleased in interface KeyListener

keyTyped

public void keyTyped(KeyEvent ke)
Handle key stroke events
Specified by:
keyTyped in interface KeyListener

gauss

public double gauss(double x,
                    double sigma)

initializeBuffer

public void initializeBuffer()
Overloaded for double buffering.

constructToolbar

public void constructToolbar()
Construct the toolbar

paint

public void paint(Graphics g)
Overloaded for double buffering.
Overrides:
paint in class Container

actionPerformed

public void actionPerformed(ActionEvent e)
Handle action events
Specified by:
actionPerformed in interface ActionListener

toggle

public void toggle()
toggle the state related with showing the parsed objects.

mouseReleased

public void mouseReleased(MouseEvent e)
Handle mouse events
Overrides:
mouseReleased in class edu.mit.sketch.toolkit.TabletDataProcessor

mouseClicked

public void mouseClicked(MouseEvent e)
Handle mouse events
Overrides:
mouseClicked in class edu.mit.sketch.toolkit.TabletDataProcessor

mouseEntered

public void mouseEntered(MouseEvent e)
Handle mouse events
Overrides:
mouseEntered in class edu.mit.sketch.toolkit.TabletDataProcessor

mouseExited

public void mouseExited(MouseEvent e)
Handle mouse events
Overrides:
mouseExited in class edu.mit.sketch.toolkit.TabletDataProcessor

mousePressed

public void mousePressed(MouseEvent e)
Handle mouse events
Overrides:
mousePressed in class edu.mit.sketch.toolkit.TabletDataProcessor

mouseDragged

public void mouseDragged(MouseEvent e)
Handle mouse motion events
Overrides:
mouseDragged in class edu.mit.sketch.toolkit.TabletDataProcessor

mouseMoved

public void mouseMoved(MouseEvent e)
Handle mouse motion events
Overrides:
mouseMoved in class edu.mit.sketch.toolkit.TabletDataProcessor

displayVertices

public void displayVertices(Vertex[] vertices)
Update various graphs and statistics.

displayFitByReversedIndices

public void displayFitByReversedIndices(int[] indices)
displayFitByIndices

displayFitByIndices

public void displayFitByIndices(int[] indices)
displayFitByIndices

update

public void update(Graphics g)
Update various graphs and statistics.
Overrides:
update in class Container

paintVelocity

public void paintVelocity(StrokeData data,
                          Color color)
Update the velocity graph.

paintAcceleration

public void paintAcceleration(StrokeData data,
                              Color color)
Update the acceleration graph.

paint_d

public void paint_d(StrokeData data,
                    Color color)
Update the direction graph.

paint_dd_dt

public void paint_dd_dt(StrokeData data,
                        Color color)
Update change in direction

paintFvsG

public void paintFvsG(double[] f,
                      double[] g,
                      Color color,
                      Component component,
                      AffineTransform transform)
Paint f vs g in the frame using the input color and affine transform. f is on the horizontal axis.

paintFvsG

public void paintFvsG(long[] f,
                      double[] g,
                      Color color,
                      Component component,
                      AffineTransform transform)
Paint f vs g in the frame using the input color and affine transform. f is on the horizontal axis.

update_fits

public void update_fits()
Update the info about the various fits (LSQE etc.)

setFitMehod

public void setFitMehod(int method)
Change the fit method, rederive the direction and related entities. Also update the graphs.

convolveDirection

public void convolveDirection()
Do convolution.

convolveChangeInDirection

public void convolveChangeInDirection()
Do convolution.

zoomY

public void zoomY(double k)
Zoom in all window's y axis by k

zoomX

public void zoomX(double k)
Zoom in all window's X axis by k

addEventListeners

public void addEventListeners()
add event listeners

setDebugging

public void setDebugging(boolean d)
Set debugging mode

reset

public void reset()
Reset the arrays

addPoint

public void addPoint(Point p,
                     long t)
Add a new point to sdr with t as the time stamp.

setRecognitionMode

public void setRecognitionMode(boolean flag)
Disable or enable recognition process by turning mouse event listening off or on. Set flag to be true if enabling is desired. Set flag to be false if disabling is desired.

combineEndPoints

public Vertex[] combineEndPoints(Vertex[] polygon)
Combines the ends of the polygon if they are sufficiently close.

simplifyPolygon

public Vertex[] simplifyPolygon(Vertex[] input_vertices)
Simplify the polygon to get rid of consecutive lines which are sufficiently parallel.

getTimeStamp

public long getTimeStamp(MouseEvent e)
This method is needed only for supporting the rather silly windows9X platform, because it is still using the dos clock.

constructGUI

public void constructGUI()
construct the GUI part of the Tablet.

setInfoMessage

public static void setInfoMessage(String message)
Set the status bar label text to the input string.

setStatusMessage

public static void setStatusMessage(String message)
Set the status bar label text to the input string.

clearScreen

public void clearScreen()
Clear screen

initializeGraphicsObjects

public void initializeGraphicsObjects()
initializeGraphicsObjects

clearComponent

public void clearComponent(Component component)
Clear the component

adjustmentValueChanged

public void adjustmentValueChanged(AdjustmentEvent e)
adjustmentValueChanged
Specified by:
adjustmentValueChanged in interface AdjustmentListener