Today, I wrote a small program encountered this problem, in the online search for someone else's ideas, sorting out the code can run, feel good!
A new application is created directly in JBuilder, as the specific steps do not describe, this code does not run directly without the main function. Below I post the code in FRAME1:
Import java.awt.*;
Import java.awt.event.*;
Import javax.swing.*;
Import com.borland.jbcl.layout.*;
Import Java.util.Date;
public class Frame1
Extends JFrame {
JPanel ContentPane;
BorderLayout borderLayout1 = new BorderLayout ();
JPanel JPanel1 = new JPanel ();
Xylayout xYLayout1 = new Xylayout ();
JScrollPane jScrollPane1 = new JScrollPane ();
JList jList1 = new JList ();
The data in the initialized JList
String[] Strdata = {
"One", "Tow", "Three"};
Time to save the click button
Long clicktime = 0;
Overridden so we can exit as window is closed
protected void processWindowEvent (WindowEvent e) {
Super.processwindowevent (e);
if (e.getid () = = windowevent.window_closing) {
System.exit (0);
}
}
The implementation of the button to double-click the function of the method, very simple algorithm, do not explain the
public Boolean checkclicktime () {
Long Nowtime = (new Date ()). GetTime ();
void jlist1_mousereleased (MouseEvent e) {
To decide whether to double-click, is to write the function you want to implement
if (Checkclicktime ()) {
System.out.println ("click Double");
}
}
}
Class Frame1_jlist1_mouseadapter
Extends Java.awt.event.MouseAdapter {
Frame1 adaptee;
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.