直接在JBuilder中新建一個應用程序
import java
import java
import javax
import com
import java
public class Frame
extends JFrame {
JPanel contentPane;
BorderLayout borderLayout
JPanel jPanel
XYLayout xYLayout
JScrollPane jScrollPane
JList jList
//初始化的JList中的數據
String[] strData = {
//保存點擊按鈕的時間
long clickTime =
//Construct the frame
public Frame
enableEvents(AWTEvent
try {
jbInit();
}
catch (Exception e) {
e
}
}
//Component initialization
private void jbInit() throws Exception {
contentPane = (JPanel)this
contentPane
this
this
jPanel
jList
contentPane
jPanel
jScrollPane
jList
}
//Overridden so we can exit when window is closed
protected void processWindowEvent(WindowEvent e) {
super
if (e
System
}
}
//具體實現按鈕雙擊的功能的方法
public boolean checkClickTime() {
long nowTime = (new Date())
if ( (nowTime
clickTime = nowTime;
return true;
}
clickTime = nowTime;
return false;
}
void jList
//判斷是否雙擊
if (checkClickTime()) {
System
}
}
}
class Frame
extends java
Frame
Frame
this
}
public void mouseReleased(MouseEvent e) {
adaptee
}
}
From:http://tw.wingwit.com/Article/program/Java/hx/201311/25810.html