This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
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


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
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!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting SHIFT key state