This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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: 2152
    
    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?
 
Similar Threads
undoProblem
converting java to xml
mousePressProblem
simple web browser in java
hotkeys in applets using awt