diff options
Diffstat (limited to 'src/com/fourisland/fourpuzzle/transition/TransitionCallbackThread.java')
-rw-r--r-- | src/com/fourisland/fourpuzzle/transition/TransitionCallbackThread.java | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/com/fourisland/fourpuzzle/transition/TransitionCallbackThread.java b/src/com/fourisland/fourpuzzle/transition/TransitionCallbackThread.java new file mode 100644 index 0000000..58ea0b5 --- /dev/null +++ b/src/com/fourisland/fourpuzzle/transition/TransitionCallbackThread.java | |||
@@ -0,0 +1,40 @@ | |||
1 | /* | ||
2 | * To change this template, choose Tools | Templates | ||
3 | * and open the template in the editor. | ||
4 | */ | ||
5 | |||
6 | package com.fourisland.fourpuzzle.transition; | ||
7 | |||
8 | import com.fourisland.fourpuzzle.Display; | ||
9 | import java.util.logging.Level; | ||
10 | import java.util.logging.Logger; | ||
11 | |||
12 | /** | ||
13 | * | ||
14 | * @author hatkirby | ||
15 | */ | ||
16 | public class TransitionCallbackThread implements Runnable { | ||
17 | |||
18 | private Runnable callback; | ||
19 | public TransitionCallbackThread(Runnable callback) | ||
20 | { | ||
21 | this.callback = callback; | ||
22 | } | ||
23 | |||
24 | public void run() | ||
25 | { | ||
26 | while (Display.getTransition().isRunning()) | ||
27 | { | ||
28 | try { | ||
29 | Thread.sleep(300); | ||
30 | } catch (InterruptedException ex) { | ||
31 | Logger.getLogger(TransitionCallbackThread.class.getName()).log(Level.SEVERE, null, ex); | ||
32 | } | ||
33 | } | ||
34 | |||
35 | //Display.setEnabled(false); | ||
36 | |||
37 | callback.run(); | ||
38 | } | ||
39 | |||
40 | } | ||