I need small help from you. How can we perform action for mouse popup menu?
I created a JPopupMenu with some menu items for mouse right button in my program.
Suppose....
click the mouse right button -->load
copy
paste
cut
Now I want following thing: How can write t开发者_如何学Gohe mouse events to perform the actions for every individual menu items.
If I select the "load" item it has to call another class, like that. Please help to do this.
You may want to assign ActionListeners
or Actions
to your specific menu items which then perform the specific tasks. You can find a detailed introduction to menus and actions in the swing tutorials.
精彩评论