我想在table中实现点击鼠标右键出现下拉列表中包括添加,删除等属性
请问怎么实现?
我只能实现相应鼠标事件,不知道怎样添加右键属性!
import java.awt.*;
import java.awt.event.*;
public class Test extends Frame implements MouseListener
{
public Test() {
addMouseListener(this);
setSize(300, 300);
setVisible(true);
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
});
}
public void mouseEntered(MouseEvent e) {}
public void mouseExited(MouseEvent e) {}
public void mousePressed(MouseEvent e) {}
public void mouseReleased(MouseEvent e) {}
public void mouseClicked(MouseEvent e) {
if (e.getButton() == MouseEvent.BUTTON1)
{
setTitle("\u9F20\u6807\u5DE6\u952E\u6309\u4E0B");
}
else if (e.getButton() == MouseEvent.BUTTON3)
{
setTitle("\u9F20\u6807\u53F3\u952E\u6309\u4E0B");
}
}
public static void main(String[] args)
{
new Test();
}
}
----------------解决方案--------------------------------------------------------
试试RightMouseDown看行不行,编程语句中看见过这个单词呵呵!行不行我就不知道了!
----------------解决方案--------------------------------------------------------
解决了,使用Jpopup!
----------------解决方案--------------------------------------------------------