File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Firing a mouse clicked event

 
G Estes
Ranch Hand
Posts: 62
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to internally, fire a MouseClicked event, passing in a Point (or x,y coordinates) as to where that mouse click took place?
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure. Do you want to actually DO that click?
If you use the Robot class you can do a mouseMove(x,y) then a mousePress(button); and it will happen.
If you actually want to just stick something in the EventQueue it is a little more tricky.
 
G Estes
Ranch Hand
Posts: 62
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your suggestion about the Robot class. Hadn't thought of that. What I'm trying to accomplish is to have a cell in a JTable be selected via the TAB key, so that the cursor shows itself and the full text of the cell is selected as well. I'm not sure the Robot class is the way to go...as I should think something like editCell(row,col) should do it (but it's not).
Any other ideas?
 
G Estes
Ranch Hand
Posts: 62
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm looking at creating a MouseEvent and using the processMouseEvent(MouseEvent ev) method of the JTable. When I create a mouse event, it asks for a time (when) of the event, but the documentation I'm seeing doesn't say much about format other than it is a long. Any enlightenment?
 
Bill Liteplo
Ranch Hand
Posts: 88
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try
Bill
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic