From a6300d8ba5b1bf89737b14338c78ea9dc9e9c5b4 Mon Sep 17 00:00:00 2001 From: nathan Date: Sun, 20 Aug 2017 22:54:47 +0200 Subject: [PATCH] Changed method order to make logical sense --- src/dorkbox/util/swing/SwingActiveRender.java | 69 +++++++++---------- 1 file changed, 34 insertions(+), 35 deletions(-) diff --git a/src/dorkbox/util/swing/SwingActiveRender.java b/src/dorkbox/util/swing/SwingActiveRender.java index 43d879c..f6e22f2 100644 --- a/src/dorkbox/util/swing/SwingActiveRender.java +++ b/src/dorkbox/util/swing/SwingActiveRender.java @@ -97,6 +97,40 @@ class SwingActiveRender { } } + /** + * Removes a window from the ActiveRender queue. This should happen when the window is closed. + * + * @param window the window to remove + */ + public static + void removeActiveRender(final Window window) { + synchronized (activeRenders) { + activeRenders.remove(window); + + final boolean hadActiveRenders = !activeRenders.isEmpty(); + hasActiveRenders = hadActiveRenders; + + if (!hadActiveRenders) { + activeRenderThread = null; + } + } + + // have to specify ALL children in window to obey EDT paint requests + Deque components = new ArrayDeque(8); + components.add(window); + + Component[] c; + Component pop; + while ((pop = components.poll()) != null) { + pop.setIgnoreRepaint(false); + + if (pop instanceof JComponent) { + c = ((JComponent) pop).getComponents(); + Collections.addAll(components, c); + } + } + } + /** * Specifies an ActionHandler to be called when the ActiveRender thread starts to render at each tick. * @@ -135,41 +169,6 @@ class SwingActiveRender { } } - - /** - * Removes a window from the ActiveRender queue. This should happen when the window is closed. - * - * @param window the window to remove - */ - public static - void removeActiveRender(final Window window) { - synchronized (activeRenders) { - activeRenders.remove(window); - - final boolean hadActiveRenders = !activeRenders.isEmpty(); - hasActiveRenders = hadActiveRenders; - - if (!hadActiveRenders) { - activeRenderThread = null; - } - } - - // have to specify ALL children in window to obey EDT paint requests - Deque components = new ArrayDeque(8); - components.add(window); - - Component[] c; - Component pop; - while ((pop = components.poll()) != null) { - pop.setIgnoreRepaint(false); - - if (pop instanceof JComponent) { - c = ((JComponent) pop).getComponents(); - Collections.addAll(components, c); - } - } - } - /** * Creates (if necessary) the active-render thread. When there are no active-render targets, this thread will exit */