New tooltips (support delayed displaying, mana and tap symbols, styled text).

This commit is contained in:
magenoxx 2010-12-15 07:14:35 +03:00
parent 1a945de4de
commit 94d883b5ba
7 changed files with 95 additions and 38 deletions

View file

@ -0,0 +1,54 @@
package mage.utils;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
/**
* Util method to work with threads.
*
* @author ayrat
*/
public class ThreadUtils {
static public ThreadPoolExecutor threadPool;
static public ThreadPoolExecutor threadPool2;
static private int threadCount;
static {
threadPool = new ThreadPoolExecutor(4, 4, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue(), new ThreadFactory() {
public Thread newThread (Runnable runnable) {
threadCount++;
Thread thread = new Thread(runnable, "Util" + threadCount);
thread.setDaemon(true);
return thread;
}
});
threadPool.prestartAllCoreThreads();
threadPool2 = new ThreadPoolExecutor(4, 4, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue(), new ThreadFactory() {
public Thread newThread (Runnable runnable) {
threadCount++;
Thread thread = new Thread(runnable, "TP2" + threadCount);
thread.setDaemon(true);
return thread;
}
});
threadPool2.prestartAllCoreThreads();
}
static public void sleep (int millis) {
try {
Thread.sleep(millis);
} catch (InterruptedException ignored) {
}
}
static public void wait (Object lock) {
synchronized (lock) {
try {
lock.wait();
} catch (InterruptedException ex) {
}
}
}
}