Popup menu problem.
Hi.
I want to make a popup menu which will be showing me chortcuts (copy, paste,cut, delete) and if I press them will change my JTable:
Popup menu works but I don't know why shortcuts doesn't.
Here is some code:
publicvoid createPopupMenu(JTable table){
JMenuItem menuItem;
JPopupMenu popup =new JPopupMenu();
menuItem =new JMenuItem("Copy CTRL+C");
menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_C,InputEvent.CTRL_MASK));
//menuItem.setActionCommand("copy");
menuItem.addActionListener(this);
popup.add(menuItem);
menuItem =new JMenuItem("Paste CTRL+V");
menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_V,KeyEvent.CTRL_DOWN_MASK));
//menuItem.setActionCommand("paste");
menuItem.addActionListener(this);
popup.add(menuItem);
menuItem =new JMenuItem("Delete");
menuItem.setAccelerator(KeyStroke.getKeyStroke("DELETE"));
//menuItem.setActionCommand("kasuj");
menuItem.addActionListener(this);
popup.add(menuItem);
MouseListener popupListener =new PopupListener(popup);
table.addMouseListener(popupListener);
}
I use Java Excel Adapter to copy from excel sheet. I works fine but in my shortcuts in popup menu doesn't.
http://www.physionet.org/physiotools/puka/sourceCode/subjectData/ExcelAdapter.java
to use shortcuts from ExcelAdapter i write:
ExcelAdapter myAd =new ExcelAdapter(table);
calcColumnWidths sze =new calcColumnWidths(table);
Those shortcuts works fine in Jtable but doesn't i popupmenu.

