Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #23990
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.fsmpi.rwth-aachen.de!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | ram@zedat.fu-berlin.de (Stefan Ram) |
| Newsgroups | comp.lang.java.programmer |
| Subject | The invokeLater loop |
| Date | 10 May 2013 18:54:38 GMT |
| Organization | Stefan Ram |
| Lines | 22 |
| Message-ID | <invokeLater-loop-20130510204735@ram.dialup.fu-berlin.de> (permalink) |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Content-Transfer-Encoding | 8bit |
| X-Trace | news.uni-berlin.de wvmGy2+QWTwavC1VkErB7QjAarUqNVeKDB6qO5arRdM7v7 |
| X-Copyright | (C) Copyright 2013 Stefan Ram. All rights reserved. Distribution through any means other than regular usenet channels is forbidden. It is forbidden to publish this article in the world wide web. It is forbidden to change URIs of this article into links. It is forbidden to remove this notice or to transfer the body without this notice. |
| X-No-Html | yes |
| Content-Language | en |
| Xref | csiph.com comp.lang.java.programmer:23990 |
Show key headers only | View raw
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.
Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar | Unroll thread
The invokeLater loop ram@zedat.fu-berlin.de (Stefan Ram) - 2013-05-10 18:54 +0000
Re: The invokeLater loop Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-05-10 12:18 -0700
Re: The invokeLater loop Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-05-10 14:26 -0700
Re: The invokeLater loop Joerg Meier <joergmmeier@arcor.de> - 2013-05-10 23:28 +0200
Re: The invokeLater loop Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-05-10 17:39 -0400
Re: The invokeLater loop Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2013-05-10 23:50 +0200
Re: The invokeLater loop markspace <markspace@nospam.nospam> - 2013-05-10 14:51 -0700
Re: The invokeLater loop Silvio <silvio@internet.com> - 2013-05-11 00:26 +0200
Re: The invokeLater loop Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-05-10 15:52 -0700
Re: The invokeLater loop Roedy Green <see_website@mindprod.com.invalid> - 2013-05-10 23:27 -0700
Re: The invokeLater loop "Qu0ll" <Qu0llSixFour@gmail.com> - 2013-05-12 19:44 +1000
Re: The invokeLater loop Knute Johnson <eternal@knutejohnson.com> - 2014-01-30 20:48 -0800
csiph-web