aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Java KeyStroke KeyEvent for DELETE but what ActionEvent needed? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Java KeyStroke KeyEvent for DELETE but what ActionEvent needed?" Watch "Java KeyStroke KeyEvent for DELETE but what ActionEvent needed?" New topic
Author

Java KeyStroke KeyEvent for DELETE but what ActionEvent needed?

John H Lee
Greenhorn

Joined: Mar 11, 2008
Posts: 6
I have the following code for a JPanel where I want to make a menu bar with a delete option. This action will delete a selected row off a JList. I've built this using the Java Swing tutorials on Oracle's site and using their TransferHandler class, which does CUT, COPY and PASTE.

My current problem is that I must type "SHIFT - DELETE" for the CUT action to execute but I want it to run when pressing "DELETE" by its self. I believe this is dependent on the ACtionEvent. This application will be running on Windows.

Any thoughts please?

Thanks!




Java Advocate
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2215
    
    7


My current problem is that I must type "SHIFT - DELETE" for the CUT action to execute but I want it to run when pressing "DELETE" by its self


Don't specify the meta mask as part of the keystroke.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java KeyStroke KeyEvent for DELETE but what ActionEvent needed?