Path: csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!news.glorb.com!news-out.readnews.com!news-xxxfer.readnews.com!news-out.news.tds.net!newsreading01.news.tds.net!86597e80!not-for-mail From: "Stefan Rybacki" Subject: Re: Sharing ListSelection Message-ID: <48fa372e$1@news.uni-rostock.de> X-Comment-To: comp.lang.java.gui Newsgroups: comp.lang.java.gui In-Reply-To: References: Content-Type: text/plain; charset=IBM437 Content-Transfer-Encoding: 8bit X-Gateway: time.synchro.net [Synchronet 3.15a-Win32 NewsLink 1.92] Lines: 50 Date: Wed, 27 Apr 2011 15:50:18 GMT NNTP-Posting-Host: 96.60.20.240 X-Complaints-To: news@tds.net X-Trace: newsreading01.news.tds.net 1303919418 96.60.20.240 (Wed, 27 Apr 2011 10:50:18 CDT) NNTP-Posting-Date: Wed, 27 Apr 2011 10:50:18 CDT Organization: TDS.net Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.gui:4388 To: comp.lang.java.gui Lew schrieb: > John B. Matthews wrote: >> perhaps something like this might work: > > A couple of things concern me about this code. > You are right but keep in mind that this was hacked together very quick to show the behaviour I was talking about. >... >> for (int i = 0; i < 10; i++) >> model.addElement(String.format("Item number %d", i)); >> >> SwingUtilities.invokeLater(new Runnable() { > > And here you finally push code onto the EDT, but the construction was not. I'm not aware that the construction actually needs to be pushed to the EDT. Why should I? I mean what if the construction takes a while for whatever reasons the EDT is blocked? Do you have any resource stating that also the construction should be pushed to the EDT? > >> //@Override >> public void run() { >> frame.setSize(500, 500); >> frame.setVisible(true); > > No call to 'pack()'. Sometimes pack() actually results in weird behaviour. I don't have an example now but remember I had unexpected behaviour in some cases. > >> } >> >> }); >> } >> } >> > Stefan --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24