[討論] 滑鼠一起按@@"

看板java作者 (thinking in java)時間19年前 (2006/01/18 19:18), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/2 (看更多)
我提供了一個鳥方法XD import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.JFrame; public class F extends JFrame { public long p_time = 0; public int limit = 90; public F() { this.addMouseListener(new MouseAdapter() { public void mouseClicked(MouseEvent e) { System.out.println(e + "\t"); long get_time = System.currentTimeMillis(); if (get_time - p_time < limit) System.out.println("2 button click at the same time"); p_time = get_time; } }); this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); this.setSize(40, 40); this.setVisible(true); } public static void main(String[] args) { new F(); } } -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 163.26.34.20
文章代碼(AID): #13pYGSm4 (java)
討論串 (同標題文章)
文章代碼(AID): #13pYGSm4 (java)