});
}
public TabletTest()
{
final TabletWrapper tabletWrapper = TabletWrapper.getInstance();
final TabletListener listener = new TabletListener() {
public void tabletEvent( TabletEvent e ) {
System.out.println( "TabletEvent" );
System.out.println( " id " + e.getID() );
System.out.println( " deviceID " + e.getDeviceID() );
System.out.println( " x " + e.getX() );
System.out.println( " y " + e.getY() );
System.out.println( " absoluteY " + e.getAbsoluteY() );
System.out.println( " absoluteX " + e.getAbsoluteX() );
System.out.println( " absoluteZ " + e.getAbsoluteZ() );
System.out.println( " buttonMask " + e.getButtonMask() );
System.out.println( " clickCount " + e.getClickCount() );
System.out.println( " pressure " + e.getPressure() );
System.out.println( " rotation " + e.getRotation() );
System.out.println( " tiltX " + e.getTiltX() );
System.out.println( " tiltY " + e.getTiltY() );
System.out.println( " tangentialPressure " + e.getTangentialPressure() );
System.out.println( " vendorDefined1 " + e.getVendorDefined1() );
System.out.println( " vendorDefined2 " + e.getVendorDefined2() );
System.out.println( " vendorDefined3 " + e.getVendorDefined3() );
System.out.println();
}
public void tabletProximity( TabletProximityEvent e ) {
System.out.println( "TabletProximityEvent" );
System.out.println( " capabilityMask " + e.getCapabilityMask() );
System.out.println( " deviceID " + e.getDeviceID() );
System.out.println( " enteringProximity " + e.isEnteringProximity() );
System.out.println( " pointingDeviceID " + e.getPointingDeviceID() );
System.out.println( " pointingDeviceSerialNumber " + e.getPointingDeviceSerialNumber() );
System.out.println( " pointingDeviceType " + e.getPointingDeviceType() );
System.out.println( " systemTabletID " + e.getSystemTabletID() );
System.out.println( " tabletID " + e.getTabletID() );
System.out.println( " uniqueID " + e.getUniqueID() );
System.out.println( " vendorID " + e.getVendorID() );
System.out.println( " vendorPointingDeviceType " + e.getVendorPointingDeviceType() );
System.out.println();
}
};
JFrame f = new JFrame();
JPanel p = new JPanel();
final Container cp = f.getContentPane();
p.setBackground( Color.red );
cp.setLayout( new GridLayout( 3, 3 ));
for( int i = 0; i < 4; i++ ) cp.add( new JLabel() );
cp.add( p );
for( int i = 0; i < 4; i++ ) cp.add( new JLabel() );
p.addMouseListener( new MouseAdapter() {
public void mouseEntered( MouseEvent e ) {
tabletWrapper.addTabletListener( listener );
}
public void mouseExited( MouseEvent e ) {
tabletWrapper.removeTabletListener( listener );
}
});
f.setSize( 300, 300 );
f.setVisible( true );