I ran the following test code on my system with Windows 7 and a wacom (Intuos) driver:
importjava.awt.*;importjava.awt.event.*;importjavax.swing.*;importjpen.event.*;importjpen.*;importjpen.provider.wintab.WintabProvider;importjpen.owner.multiAwt.AwtPenToolkit;publicclassTest{publicstaticvoidmain(String[]args){finalPenManagerpenManager=AwtPenToolkit.getPenManager();penManager.pen.setFirePenTockOnSwing(true);finalJLabelpenLabel=newJLabel();penLabel.setOpaque(true);penLabel.setBackground(Color.yellow);penLabel.setHorizontalAlignment(SwingConstants.CENTER);AwtPenToolkit.addPenListener(penLabel,newPenAdapter(){@OverridepublicvoidpenTock(longavailableMillis){penLabel.setText("X: "+penManager.pen.getLevelValue(PLevel.Type.X));}});finalWintabProviderwintabProvider=AwtPenToolkit.getPenManager().getProvider(WintabProvider.class);if(wintabProvider==null){System.out.println("This test is for the Windows OS.");return;}JPanelbuttonsP=newJPanel();JButtononB=newJButton("On");onB.addActionListener(newActionListener(){//@OverridepublicvoidactionPerformed(ActionEventev){wintabProvider.setSystemCursorEnabled(true);}});buttonsP.add(onB);JButtonoffB=newJButton("Off");offB.addActionListener(newActionListener(){//@OverridepublicvoidactionPerformed(ActionEventev){wintabProvider.setSystemCursorEnabled(false);}});buttonsP.add(offB);JPanelpanel=newJPanel(newBorderLayout());panel.add(penLabel);panel.add(buttonsP,BorderLayout.SOUTH);JFramef=newJFrame("JPen - WintabProvider - cursor enabling test");f.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);f.setMinimumSize(newDimension(300,300));f.add(panel);f.pack();f.setVisible(true);}}
Having the tablet in pen mode (wacom properties setting, pen mode is absolute coordinate mapping), I press the "Off" button to disable the cursor and then disconnect/reconnect the tablet. After reconnection the cursor remains disabled and (if the cursor is on the yellow label and the JFrame is active) the tablet resumes sending data to the wintab provider (the x values change with subpixel precision on the yellow label)... everything seems to be working as expected. I guess that the problem is with the genius wintab driver (I don't have a genius tablet to test this on) :-S
-Are you using the latest drivers available for your tablet?
I tried the test code and it gave the same result as I experienced earlier: first time the "Off" button works but after reconnecting the genius tablet the system cursor became active and stays in enabled state despite pressing the "Off" button.
Unfortunately the recommended double setSystemCursorEnabled with true and false state does not help.
But...
When I checked the basic functionality with debugging and the code executed line by line luckily I realized if I slowly stepping through the code the setSystemCursorEnabled works perfectly! After more research it looks like that inserting a sleep call "repairs" the fault.
hi Peter,
do you have to introduce the sleep time and call the setSystemCursorEnabled(false) only once during the lifetime of the application (and the cursor remains disabled after many reconnections and everything works as expected) or do you have to invoke this code snippet (create a new PenManager, sleep, call setSystemCursorEnabled(false)) every time after reconnection for the cursor to be disabled?
cheers!
Nicolas
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Unfortunately it works only once, after reconnection the cursor become enabled and further setSystemCursorEnabled(false) call (or the true/false calls) does not work.
By the way, is there method to reinitialize (or cleanup and recreate) an active penManager?
Thank you!
Regards,
Peter
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It works as expected on my system (wacom wintab implementation)... pressing "Recreate PenManager" has the same effect as pressing the "Off" button which disables the system cursor.
The right way to solve this bug would be to forward it to the genius developer team (no pun intended ;-)... but I don't want to do it myself because it requires a test case with better isolation of the problem and I don't have the hardware (genius tablet) to prepare it. I opened a bug report on our bug database here https://sourceforge.net/p/jpen/bugs/21/ .
Cheers!
Nicolas
Last edit: Nicolas Carranza 2014-03-06
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you very much for the test code. Disabling the cursor works only after restarting the test app, even with the thread sleep inserted. I experienced similar behavior earlier, this is why i asked the correct initialization method.
I'm trying to contact with genius tech support.
Regards,
Peter
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
On WinXP the setSystemCursorEnabled function works as expected with the following code:
But after I disconnect and plug back my Genius EasyPen i405X tablet to the same USB port the above code does not disable the cursor.
What could be the problem?
Thanks,
Peter
hi Peter,
I ran the following test code on my system with Windows 7 and a wacom (Intuos) driver:
Having the tablet in pen mode (wacom properties setting, pen mode is absolute coordinate mapping), I press the "Off" button to disable the cursor and then disconnect/reconnect the tablet. After reconnection the cursor remains disabled and (if the cursor is on the yellow label and the JFrame is active) the tablet resumes sending data to the wintab provider (the x values change with subpixel precision on the yellow label)... everything seems to be working as expected. I guess that the problem is with the genius wintab driver (I don't have a genius tablet to test this on) :-S
-Are you using the latest drivers available for your tablet?
-Try changing the line of the test code:
to these two lines:
and test pressing the "Off" button after reconnecting the tablet, does it disable the cursor?
Cheers,
Nicolas
Hi Nicolas,
Thank you for the detailed example.
I have the latest drivers installed.
I tried the test code and it gave the same result as I experienced earlier: first time the "Off" button works but after reconnecting the genius tablet the system cursor became active and stays in enabled state despite pressing the "Off" button.
Unfortunately the recommended double setSystemCursorEnabled with true and false state does not help.
But...
When I checked the basic functionality with debugging and the code executed line by line luckily I realized if I slowly stepping through the code the setSystemCursorEnabled works perfectly! After more research it looks like that inserting a sleep call "repairs" the fault.
It works either with the first or second sleep - but e.g 1000ms is not enough, with 2000ms it is ok. Very annoying...
I'm afraid this is not an unfailing solution :\
What do you think?
Thank you!
Peter
hi Peter,
do you have to introduce the sleep time and call the setSystemCursorEnabled(false) only once during the lifetime of the application (and the cursor remains disabled after many reconnections and everything works as expected) or do you have to invoke this code snippet (create a new PenManager, sleep, call setSystemCursorEnabled(false)) every time after reconnection for the cursor to be disabled?
cheers!
Nicolas
Hi Nicolas,
Unfortunately it works only once, after reconnection the cursor become enabled and further setSystemCursorEnabled(false) call (or the true/false calls) does not work.
By the way, is there method to reinitialize (or cleanup and recreate) an active penManager?
Thank you!
Regards,
Peter
hi Peter, a way to reinitialize the pen event source could be recreating the PenManager. You can play with the following:
It works as expected on my system (wacom wintab implementation)... pressing "Recreate PenManager" has the same effect as pressing the "Off" button which disables the system cursor.
The right way to solve this bug would be to forward it to the genius developer team (no pun intended ;-)... but I don't want to do it myself because it requires a test case with better isolation of the problem and I don't have the hardware (genius tablet) to prepare it. I opened a bug report on our bug database here https://sourceforge.net/p/jpen/bugs/21/ .
Cheers!
Nicolas
Last edit: Nicolas Carranza 2014-03-06
Hi Nicolas,
Thank you very much for the test code. Disabling the cursor works only after restarting the test app, even with the thread sleep inserted. I experienced similar behavior earlier, this is why i asked the correct initialization method.
I'm trying to contact with genius tech support.
Regards,
Peter