开发者

assigning mouse actions forJPopupMenu

开发者 https://www.devze.com 2023-03-13 01:15 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消