aspose file tools*
The moose likes Java in General and the fly likes how to create key stroke listen? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "how to create key stroke listen?" Watch "how to create key stroke listen?" New topic
Author

how to create key stroke listen?

reubin haz
Ranch Hand

Joined: May 12, 2005
Posts: 287
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.


SCJA, SCJP5.0, SCBCD, SCWCD
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18669
    
    8

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

Joined: May 12, 2005
Posts: 287
thanks for your point, that way is much better.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to create key stroke listen?