加入JButton的事件監聽
JButton btnTest;
btnTest.addMouseListener(new java.awt.event.MouseAdapter()
{
public void mouseClicked(MouseEvent evt)
{
             if(evt.getClickedCount()==1)
             {}
             else if(evt.getClickedCount()==2)
             {}   
}
});

解决方案 »

  1.   

    你试一试,好像不可以,这种方法我早就试过了!
    各位高手还有其他方法吗?
    kkkkkk!
      

  2.   

    当时的结果是响应双击事件之前肯定会先响应单击事件.我认为如果你一定要处理单击事件的话可以全局标志int nClickedCount = 0; 
    if(evt.getClickedCount()==1){
       this.nClickedCount = 1;
       //延时一段时间    
       if(this.getClickedCount()==1){
           //单击
       } 
    }
    if( evt.getClickedCount()==2 ){
       this.nClickedCount = 2;
       //双击
    }你试试看好不好用,我没有测试过。