Path: csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!news.alt.net!news-in-01.newsfeed.easynews.com!easynews.com!easynews!news-out.news.tds.net!newsreading01.news.tds.net!86597e80!not-for-mail From: "Andrew Thompson" Subject: Re: Can a jPanel's backgr Message-ID: <737c4e55bac1d@uwe> X-Comment-To: comp.lang.java.gui Newsgroups: comp.lang.java.gui In-Reply-To: <1181468093_2183@sicinfo3.epfl.ch> References: <1181468093_2183@sicinfo3.epfl.ch> Content-Type: text/plain; charset=IBM437 Content-Transfer-Encoding: 8bit X-Gateway: time.synchro.net [Synchronet 3.15a-Win32 NewsLink 1.92] Lines: 61 Date: Wed, 27 Apr 2011 15:35:19 GMT NNTP-Posting-Host: 96.60.20.240 X-Complaints-To: news@tds.net X-Trace: newsreading01.news.tds.net 1303918519 96.60.20.240 (Wed, 27 Apr 2011 10:35:19 CDT) NNTP-Posting-Date: Wed, 27 Apr 2011 10:35:19 CDT Organization: TDS.net Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.gui:1782 To: comp.lang.java.gui Philipp wrote: >Andrew Thompson a |-crit : >>>> In any case, it is possible to *extend* JPanel (or jPanel, >>>> I am guessing) to provide a method that will do that. .. Please refrain from 'full-quoting'. Selective trimming of earlier posts does wonders. Note that my current web interface to usenet automatically trims most text before I get to reply. >Shouldn't the GUI be updated from the EDT thread? How would this be done? Yes and no. The 'rule' is that UI updates outside the EDT should be updated using invokeLater, something like.. public void run() { while (true) { if ( flashing ) { active = !active; Runnable r = new Runnable(){ public void run(){ repaint(); } }; EventQueue.invokeLater(r); if ( System.currentTimeMillis()-startFlash>lengthFlash ) { flashing = false; } } try { Thread.sleep(400); } catch (InterruptedException ie) { // wake and continue } } } I say 'rule' because I have never observed any GUI problems to be caused by ignoring it. (shrugs) YMMV. [ Waits for the invokeLater devotees to jump in with lots of long words and remonstrations - with no code that can back up the claims. ] -- Message posted via JavaKB.com http://www.javakb.com/Uwe/Forums.aspx/java-gui/200706/1 --- * 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