文件名称:java 右键菜单
文件大小:2KB
文件格式:JAVA
更新时间:2018-01-17 09:28:01
右键菜单 浮动菜单 java 源码
代码可以实现单击右键,出现浮动菜单// New project menu item JMenuItem menuItem = new JMenuItem("New Project...", new ImageIcon("images/newproject.png")); menuItem.setMnemonic(KeyEvent.VK_P); menuItem.getAccessibleContext().setAccessibleDescription( "New Project"); menuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JOptionPane.showMessageDialog(frame, "New Project clicked!"); } });