代码可以实现单击右键,出现浮动菜单//NewprojectmenuitemJMenuItemmenuItem=newJMenuItem("NewProject...",newImageIcon("images/newproject.png"));menuItem.setMnemonic(KeyEvent.VK_P);menuItem.getAccessibleContext().setAccessibleDescription("NewProject");