awt - I want to add Shortcut JUST DELETE in java -


notepad.

notepad made.

how add menushortcut delete in line 9? plz me....

ms[0] = new menushortcut(keyevent.vk_n); ms[1] = new menushortcut(keyevent.vk_o); ms[2] = new menushortcut(keyevent.vk_s); ms[3] = new menushortcut(keyevent.vk_p); ms[4] = new menushortcut(keyevent.vk_z); ms[5] = new menushortcut(keyevent.vk_x); ms[6] = new menushortcut(keyevent.vk_c); ms[7] = new menushortcut(keyevent.vk_v); ms[8] = new menushortcut(keyevent.vk_delete); ms[9] = new menushortcut(keyevent.vk_f); ms[10] = new menushortcut(keyevent.vk_f3); ms[11] = new menushortcut(keyevent.vk_h); ms[12] = new menushortcut(keyevent.vk_g); ms[13] = new menushortcut(keyevent.vk_a); ms[14] = new menushortcut(keyevent.vk_f5); 

try this:

menuitem.setaccelerator(keystroke.getkeystroke(     java.awt.event.keyevent.vk_s,      java.awt.event.ctrl_mask)); 

where vk_s the key want , ctrl_mask control key.

there option using

menuitem.setmnemonic('f'); 

this work if press alt+f when running program

for delete use

jmenuitem1.setaccelerator(javax.swing.keystroke.getkeystroke(java.awt.event.keyevent.vk_delete, 0)); 

Comments

Popular posts from this blog

javascript - Thinglink image not visible until browser resize -

firebird - Error "invalid transaction handle (expecting explicit transaction start)" executing script from Delphi -

mongodb - How to keep track of users making Stripe Payments -