JTablet 1.2.0 API

cello.jtablet
Class TabletManager

java.lang.Object
  extended by cello.jtablet.TabletManager

public abstract class TabletManager
extends Object

TabletManager is responsible for detecting interesting events, translating them into TabletEvent objects, and finally broadcasting them to all registered TabletListeners. TabletManager relies on concrete private subclasses to grab events from particular native libraries (e.g. Wacom's WinTab driver, Cocoa's NSEvent system, or X11's XInput). Given the difficulty in determining if a particular native library is supported on the end-user's system, we provide the simple static TabletManager.getDefaultManager() method that is guarnteed to return a TabletManager which is compatible.

Example usage:

  // Get tablet manager
  TabletManager manager = TabletManager.getDefaultManager();
  
  // Add tablet listener to component
  manager.addTabletListener(component, new TabletAdapter() {
      public void cursorDragged(TabletEvent event) {
          // Print out tablet drag events as they occur to system output
          System.out.println("dragged " + event);
      }
  });
 

Author:
marcello
See Also:
TabletListener

Constructor Summary
protected TabletManager()
          To obtain a reference to a TabletManager, call the static TabletManager.getDefaultManager() method.
 
Method Summary
abstract  void addScreenTabletListener(TabletListener listener)
          Adds a TabletListener to the entire screen.
abstract  void addTabletListener(Component component, TabletListener listener)
          Adds a TabletListener to a specific Component.
static TabletManager getDefaultManager()
          Returns a shared tablet manager with the default settings.
 DriverStatus getDriverStatus()
          Returns the tablet driver status for this tablet manager.
abstract  void removeScreenTabletListener(TabletListener listener)
          Removes a TabletListener previously added with addScreenTabletListener(TabletListener).
abstract  void removeTabletListener(Component component, TabletListener listener)
          Removes a TabletListener previously added to a specific component with addTabletListener(Component,TabletListener).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TabletManager

protected TabletManager()
To obtain a reference to a TabletManager, call the static TabletManager.getDefaultManager() method.

Method Detail

getDefaultManager

public static TabletManager getDefaultManager()
Returns a shared tablet manager with the default settings.

Returns:
the TabletManager for the whole system

addScreenTabletListener

public abstract void addScreenTabletListener(TabletListener listener)
Adds a TabletListener to the entire screen. This works very much like adding a MouseListener and MouseMotionListener on the component, meaning:

Implementation Note: behavior for this method is undefined when working with mouse input (i.e. no native library was loaded or the user is not using the tablet). Please use addTabletListener(Component, TabletListener) when working with on-screen components.

Parameters:
listener - the listener to add
See Also:
TabletListener, addTabletListener(Component, TabletListener)

removeScreenTabletListener

public abstract void removeScreenTabletListener(TabletListener listener)
Removes a TabletListener previously added with addScreenTabletListener(TabletListener). It is safe to call this method if the specified listener has not been added (or already removed).

Parameters:
listener - the listener to remove

addTabletListener

public abstract void addTabletListener(Component component,
                                       TabletListener listener)
Adds a TabletListener to a specific Component. This works very much like adding a MouseListener and MouseMotionListener on the component, meaning:

Parameters:
component - component to add the listener to
listener - the listener to send events to
See Also:
TabletListener

removeTabletListener

public abstract void removeTabletListener(Component component,
                                          TabletListener listener)
Removes a TabletListener previously added to a specific component with addTabletListener(Component,TabletListener). It is safe to call this method if the specified listener has not been added to the given component (or already removed).

Parameters:
component - component to remove the listener from
listener - the listener to remove

getDriverStatus

public DriverStatus getDriverStatus()
Returns the tablet driver status for this tablet manager. This contains exception information if there was a problem instantiating the tablet driver and can be used for debugging driver/native issues. TODO: Why are we returning null?

Returns:
the current driver status

JTablet 1.2.0 API