请问各位鼠标右键时间怎么写????在线等,解决马上加分

解决方案 »

  1.   

    比如左键单机按钮事件是ActionListener listener=new ActionListener(){
    public void actionPerformed(ActionEvent)
    {}
    };
    右键是什么呢???
      

  2.   

    MouseEvent.getButton();
    然后判断一下button的类型是NOBUTTON、BUTTON1、BUTTON2 或 BUTTON3,其中botton2代表右键
      

  3.   

    接着 f_acme(沧海一声笑) 他的说
    如果是BUTTON2的话就直接调,单击时要执行的功能函数吧
      

  4.   

    我试了如果是在按钮上单即右键不会调用MouseListener事件
    只有在面版上才可以啊
      

  5.   

    UwtButton ubutton = new UwtButton();
    ubutton.addMouseListener(new MouseAdapter(){
    public void mouseClicked(MouseEvent e) {
    if (e.getButton() == MouseEvent.BUTTON3) {
    dispose();
    }
    }
    });