I am trying to create an editor using JTextpane. Now I need to show a dynamic pop up menu while pressing Ctrl + space. But the problem is that I can trigger the pop up menu only by right click of mouse. The code snippet that I used is given below.

           frame.addMouseListener(new MouseAdapter(){
                public void mouseReleased(MouseEvent Me){
                    Pmenu.show(Me.getComponent(), Me.getX(), Me.getY());

I am able to invoke Ctrl + space.. But not able to invoke pop up menu using this.Is there any method or short cut to trigger pop up menu using key board? Please help...

Thanks in advance......

Have a look at the KeyListener interface in the API doc - it allows you to respond to individual keys being pressed and/or released.

just about JPopupMenu

I'm not sure if is posible invoke JPopupMenu (rightMouseClick) with KeyBindings,

if is posible (excluding JTable) i'd prefered JDialog with JButtons,

well I tried lots of hack for JPopumMenu, but each has problem with Concurency on EDT

if you want to add JPopupMenu correctly, then add its listener to JTextPane instead of JFrame,

and create own PopupListener extends MouseAdapter, because you can pretty modify JPopupItem (dynamic contents) in

public void mouseReleased(MouseEvent e) {