cello.tablet
Class JTablet

java.lang.Object
  extended by cello.tablet.JTablet

public class JTablet
extends java.lang.Object

The entrance JTablet class. Tablet information is stateless, but this class allows it to function as a class entity.

To construct a JTablet object, you must catch JTabletException.

  try {
    JTablet jtablet = new JTablet();
  } catch (JTabletException jte) {
    System.err.println("Could not load JTablet! (" + jte.toString() + ").");
  }
`
  

See Also:
JTabletCursor, JTabletException

Field Summary
protected  JTabletCursor currentCursor
           
protected  boolean pollModeLatest
           
 
Constructor Summary
JTablet()
          Creates a new JTablet object without full control.
JTablet(boolean fullControl)
          Creates a new JTablet object.
 
Method Summary
 void close()
          Unloads the native driver for JTablet
 void finalize()
          Unloads the native driver for JTablet
 int getAngle()
          Deprecated.  
 int getButtons()
          Deprecated.  
 JTabletCursor getCursor()
          Returns the last JTabletCursor that was polled from
static java.lang.String getLibraryVersion()
          Retrieves the current JTablet version of the loaded library.
 int getOrientation()
          Deprecated.  
 int getPressure()
          Retrieves the current pressure of the tablet as an int.
 int getPressureExtent()
          Retrieves the maximum possible pressure of getPressure().
 java.lang.String getVersion()
          Retrieves the current JTablet version.
 int getX()
          Deprecated.  
 int getY()
          Deprecated.  
 int getZ()
          Deprecated.  
 boolean hasCursor()
          Checks if JTablet has a cursor.
 boolean isPollModeLatest()
          Returns if Poll mode is retrieving the latest information.
 boolean poll()
          Polls the tablet for the latest tablet information.
 void setPollModeLatest(boolean b)
          If this option is enabled (by default), whenever JTablet.poll() is called the latest information will be retrieved, rather than the next available information.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentCursor

protected JTabletCursor currentCursor

pollModeLatest

protected boolean pollModeLatest
Constructor Detail

JTablet

public JTablet()
        throws JTabletException
Creates a new JTablet object without full control.

Throws:
JTabletException - if the native library could not be loaded or no tablet is available.
See Also:
JTablet(boolean)

JTablet

public JTablet(boolean fullControl)
        throws JTabletException
Creates a new JTablet object.

Parameters:
fullControl - Tries to access the tablet with full control for digitizing purposes.
Throws:
JTabletException - if the native library could not be loaded or no tablet is available
Since:
0.9.1
Method Detail

hasCursor

public boolean hasCursor()
Checks if JTablet has a cursor. There will be no cursor until poll is called.

Returns:
if the current cursor is null
Since:
0.9.1

getCursor

public JTabletCursor getCursor()
Returns the last JTabletCursor that was polled from

Returns:
the JTabletCursor object
Since:
0.9.1

isPollModeLatest

public boolean isPollModeLatest()
Returns if Poll mode is retrieving the latest information.

Returns:
the JTabletCursor object
Since:
0.9.1
See Also:
setPollModeLatest(boolean)

setPollModeLatest

public void setPollModeLatest(boolean b)
If this option is enabled (by default), whenever JTablet.poll() is called the latest information will be retrieved, rather than the next available information. It may be useful to disable this option if you want to retrieve an extended amount of information.

Since:
0.9.1
See Also:
isPollModeLatest(), poll()

finalize

public void finalize()
              throws JTabletException
Unloads the native driver for JTablet

Overrides:
finalize in class java.lang.Object
Throws:
JTabletException - if there was an error unloading the tablet

close

public void close()
Unloads the native driver for JTablet

Throws:
JTabletException - if there was an error unloading the tablet

getVersion

public java.lang.String getVersion()
Retrieves the current JTablet version.

Returns:
a String containing version information.
Since:
0.2

getLibraryVersion

public static java.lang.String getLibraryVersion()
Retrieves the current JTablet version of the loaded library. If this doesn't match the return of JTablet.getVersion(), results may be inaccurate.

Returns:
a String containing version information.
Since:
0.9.2

poll

public boolean poll()
             throws JTabletException
Polls the tablet for the latest tablet information. This should be done as frequently as possible for the best results. If poll mode is set to latest, then this will return the last known information from the tablet, skipping anything since the last poll.

Returns:
true if any new information was retrieved
Throws:
JTabletException - if there was an error reading the tablet
See Also:
isPollModeLatest(), setPollModeLatest(boolean)

getPressure

public int getPressure()
Retrieves the current pressure of the tablet as an int. Use getPressureExtent() to find the maximum value.

See Also:
JTabletCursor.getPressure(), getPressureExtent()

getPressureExtent

public int getPressureExtent()
Retrieves the maximum possible pressure of getPressure().

Returns:
the pressure extent value
See Also:
JTabletCursor.getPressureExtent(), getPressure()

getAngle

public int getAngle()
Deprecated. 

Retrieves the angle of the tablet. As of version 0.9.1, this feature always returns 0.

Returns:
returns 0

getX

public int getX()
Deprecated. 

As of version 0.9.1, this feature always returns 0.

Returns:
returns 0

getY

public int getY()
Deprecated. 

As of version 0.9.1, this feature always returns 0.

Returns:
returns 0

getZ

public int getZ()
Deprecated. 

As of version 0.9.1, this feature always returns 0.

Returns:
returns 0

getOrientation

public int getOrientation()
Deprecated. 

Retrieves the orientation of the tablet. If this value is negative, the user has turned their stylus upside-down and is using it as an eraser. As of v0.9.1, JTabletCursor.getData() should be used instead.

Returns:
the orientation value
See Also:
JTabletCursor.getData(int)

getButtons

public int getButtons()
Deprecated. 

Retrieves the buttons from the tablet. As of v0.9.1, JTabletCursor.getData() should be used instead.

Returns:
the buttons value
See Also:
JTabletCursor.getData(int)