• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java KeyStroke KeyEvent for DELETE but what ActionEvent needed?  RSS feed

 
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: 2756
12
  • 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.

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!