Changed method order to make logical sense

This commit is contained in:
nathan 2017-08-20 22:54:47 +02:00
parent 513169b872
commit a6300d8ba5
1 changed files with 34 additions and 35 deletions

View File

@ -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<Component> components = new ArrayDeque<Component>(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<Component> components = new ArrayDeque<Component>(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
*/