Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java KeyStroke KeyEvent for DELETE but what ActionEvent needed?

 
John H Lee
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!


 
Rob Camick
Ranch Hand
Posts: 2600
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic