java - catch event of double click on icon in tray

后端 未结 6 1137

I want to make my form visible when I double click the tray icon?
How do I catch the double click on the icon?
Thanks.

6条回答
  •  悲哀的现实
    2020-12-07 02:14

    if u are planning to write ur own function for this than it go something as follows:

    catch the mouse clicked event, keep a "long timeStamp" initialize it to 0L as an instance variable,

    now double click is two clicks within 3 sec or 5 sec

    so 
    {
    if (timeStamp == 0L) {
    
    timeStamp = System.getCurrentTime(); //please chk the exact syntax of this... it gives       milli seconds
    
    } else if ((timeStamp + 5000) <= System.getCurrentTime()) // here i am giving time     window of 5 sec = 5000 milli  seconds
    
    {
    //do ur double click code;
    then set timeStamp back to 0;
    timeStamp = 0L;
    
    } else {
    //its first click
    timeStamp = System.getCurrentTime();
    
    }
    }
    

提交回复
热议问题