File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to create key stroke listen?

 
reubin haz
Ranch Hand
Posts: 287
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know how to do event listener with mouse. But I have difficulty to create key stroke listener.
I have a swing table, that when multiple rows are selected. I wanna disable a button. But users can still select multiple rows by using shift+up or shift+down.
How is the event for this kind of key stroke to be create?

Thanks.
 
Paul Clapham
Sheriff
Pie
Posts: 20166
24
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why would you need a keystroke listener for that?

If you want something to happen to your GUI when a certain selection event takes place, then just use a selection listener. Don't waste your time writing picky-picky code which looks for mouse clicks and tries to figure out what row was clicked on and then what that meant in terms of rows selected. The component does all of that for you already.
 
reubin haz
Ranch Hand
Posts: 287
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for your point, that way is much better.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic