aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Getting SHIFT key state Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Getting SHIFT key state" Watch "Getting SHIFT key state" New topic
Author

Getting SHIFT key state

Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 825
    
    5

Ok, similar problem as the one I posted here couple of months ago...
Is there a way to know when the SHIFT is down?
I'm implementing some graphics editor, so I added MouseWheelListener to my drawing surface (extended from JPanel). When user scrolls up/down, all content is scrolled up/down. The effect I want to achieve is that when user holds SHIFT key and scrolls up/down, content is scrolled right/left.


The quieter you are, the more you are able to hear.
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

By calling isShiftDown() on the event passed to your listener ?


[My Blog]
All roads lead to JavaRanch
Kemal Sokolovic
Bartender

Joined: Jun 19, 2010
Posts: 825
    
    5

Oh... so simple... :-/
My bad... thanks!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Getting SHIFT key state