Java
本类阅读TOP10
作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站
public static void runOnce(String id, final long milliseconds) { synchronized(e_queue) { // e_queue: 所有事件的集合 if (!e_queue.containsKey(id)) { e_queue.put(token, new LastOne()); } } final LastOne lastOne = (LastOne) e_queue.get(token); final long time = System.currentTimeMillis(); // 获得当前时间 lastOne.time = time; (new Thread() {public void run() { if (milliseconds > 0) { try {Thread.sleep(milliseconds);} // 暂停线程 catch (Exception ex) {} } synchronized(lastOne.running) { // 等待上一事件结束 if (lastOne.time != time) // 只处理最后一个事件 return; } }}).start(); } private static Hashtable e_queue = new Hashtable(); private static class LastOne { public long time=0; public Object running = new Object(); }
Graphics myGraphics; Image myOffscreenImage = createImage(size().width, size().height); Graphics offscreenGraphics = myOffscreenImage.getGraphics(); offscreenGraphics.drawImage(img, 50, 50, this); myGraphics.drawImage(myOffscreenImage, 0, 0, this);
public BufferedImage (int width, int height, int imageType)
public abstract int validate(GraphicsConfiguration gc);public abstract Boolean contentsLost();
setScrollMode(int mode);
相关软件: