java - Combining JMenu clipboard functions, accelerators, and actionMenu support (best practices) -
i've got component several jtables on it. i've installed custom transferhandlers on tables. now, want means invoke cut/copy/paste commands on these tables, via:
- the menubar, works on focused jtable
- popup menu on jtables
- keyboard shortcut, works on focused jtable
jtable's actionmap has entries "cut", "copy", "paste". actions these keys correct thing, invoking transferhandler.
i've tried following:
datatable.getinputmap(jcomponent.when_ancestor_of_focused_component).put(cutmenuitem.getaccelerator(), "cut");
this works when press cmd-x, not when select "cut" menu. assume because menu consumes event, , never gets jtable.
i can think of several hacky ways implement this, there clean way go it? how can menu items send actioncommand
focused component?
it's not clear how initializing menu items. jtable
not 1 of text components, may want @ ccp in non-text component regard setting edit
menu.
Comments
Post a Comment