File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Getting SHIFT key state
 
Similar Threads
I want to trap a JScrollPane event when scolled up or down and perform some stuffs
JScrollPane with multiple JEditorPanes
check if ctrl-v was pressed in content editable area?
JScrollPane is scrolled down - how to set it up and let the user scroll is down?
How do you show a component that has focus?