Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Handle Stylus Event  RSS feed

 
selva nayagam.K
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I am developing swing application. When mouse clicked on text box i have to open a dialog. It works fine.
When clicked on text box using stylus, mouse click event handling does not happens properly.
What event should I use to handle stylus click.
 
Rob Spoor
Sheriff
Posts: 21092
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What type of device are you using? Because I don't remember my work and home PCs being able to interact with styluses; only my old Windows Mobile phone was. Or do you mean you use a pen that's connected to your PC?

Either way, Swing and events have nothing to do with sockets or Internet protocols, so I'm moving this thread to our GUI forum.
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would guess that the Point of mousePressed and mouseReleased my not be close enough (as determined by system properties not configurable from Java) to generate a mouseClicked. Try using mousePressed instead.

Also
event handling does not happens properly.

Define 'properly'
 
selva nayagam.K
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI,

I have wacom touch screen monitor.

event handling does not happens properly means, when we press stylus on the text box mouse clicked event is not getting triggered.
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you read the first paragraph of my earlier response? did you try that?
 
Rob Spoor
Sheriff
Posts: 21092
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Darryl may be right. You see, a mouse click is a mouse pressed followed by a mouse released within a specific time and within a specific distance. If either the time or the distance is too great there is no mouse clicked event, but there are still the mouse pressed and mouse released events.

Can you see if those two events do get triggered? You may want to print out the event's time and point, then compare the differences:
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!