S
Stefan Ram
I invented what I call the »invokeLater loop«:
class Object implements java.lang.Runnable
{ int i = 0;
public void run()
{ java.lang.System.out.println( i++ );
javax.swing.SwingUtilities.invokeLater( this ); }}
public class Main
{ public static void main( final java.lang.String[] args )
{ javax.swing.SwingUtilities.invokeLater( new Object() ); }}
What is it good for?
Maybe it provides a way to loop while still allowing
Swing events to be processed in parallel? (So you do not
always have to spawn another thread besides the EDT.)
One also might see it as a kind of recursion that will not
overflow that stack. But since it does not atually nest
incarnations, it is not really adopted for recursive programming.
class Object implements java.lang.Runnable
{ int i = 0;
public void run()
{ java.lang.System.out.println( i++ );
javax.swing.SwingUtilities.invokeLater( this ); }}
public class Main
{ public static void main( final java.lang.String[] args )
{ javax.swing.SwingUtilities.invokeLater( new Object() ); }}
What is it good for?
Maybe it provides a way to loop while still allowing
Swing events to be processed in parallel? (So you do not
always have to spawn another thread besides the EDT.)
One also might see it as a kind of recursion that will not
overflow that stack. But since it does not atually nest
incarnations, it is not really adopted for recursive programming.