Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #5459

Re: setText() is not always updating Jtextfield and Jlabel items

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Kevin Nathan <knathan@project54.com>
Newsgroups comp.lang.java.gui
Subject Re: setText() is not always updating Jtextfield and Jlabel items
Date Mon, 2 Mar 2015 09:33:22 -0700
Lines 43
Message-ID <20150302093322.69e01a3e@efreet.linux> (permalink)
References <20150226132317.6bbbc29a@efreet.linux> <clbhokF6emnU1@mid.individual.net>
Mime-Version 1.0
Content-Type text/plain; charset=US-ASCII
Content-Transfer-Encoding 7bit
X-Trace individual.net 0KUwM/jFSH30QPCSqBg/VgDgIkCdxBY7Gahld4kBzlY3+QMQ31
Cancel-Lock sha1:CdxehK44CfdXyxH588rw1EGDRwk=
X-Newsreader Claws Mail 3.10.1 (GTK+ 2.24.18; i586-suse-linux-gnu)
X-Face %/gp4MCQT=`#JS##?-]V9ksid6OSR@(wbF"bK6wSLO$u,%(N@X~bVhAD+\A_[gRhx*T6=fq "N_5H8.v[&;q0iw!s_wuL05B0xg#OYUkbn#@&U_]fL%o==~2sphc?*L+bicO!POJLG#p'N.]J0/p_w Z^(.kOB%Ob914-V>?GI;
Xref csiph.com comp.lang.java.gui:5459

Show key headers only | View raw


On Fri, 27 Feb 2015 15:45:24 +0000
Nigel Wade <nmw@ion.le.ac.uk> wrote:

>On 26/02/15 20:23, Kevin Nathan wrote:
>> // Trying new "Motion" routine:
>> while (clerkFuncs.scaleErr == -2) {
>>      weight = clerkFuncs.readScale(tr);
>>      showMotion(weight);
>> }
>>
>>
>> private void showMotion(long wt) {
>>
>>      noteField[1][weightRow].setText(Long.toString(wt));
>>      // noteField[1][weightRow].setText("<html><font
>>      color='red'>Motion</font></html>");
>>
>>      editField[1][weightRow].setText("Motion");
>> }
>
>This is the problem.
>
>For setText() to work it needs to be invoked by the Event Dispatch
>Thread
>(http://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html)
>
>However, there is also the issue of allowing the EDT to do its work.
>If you block the thread in a loop then the EDT never gets a chance to
>do its work.
>

Thanks, Nigel, for that informative answer! I was busy all weekend with
a local outdoor event. I will be looking at this later this week. That
sure cleared up a lot of questions in my mind! 


-- 
Kevin Nathan (Arizona, USA)  
Linux is not a destination, it's a journey -- enjoy the trip!

Linux 3.7.10-1.45-desktop
 09:30am  up 10 days 23:59,  18 users,  load average: 1.35, 0.73, 0.52

Back to comp.lang.java.gui | Previous | NextPrevious in thread | Find similar


Thread

setText() is not always updating Jtextfield and Jlabel items Kevin Nathan <knathan@project54.com> - 2015-02-26 13:23 -0700
  Re: setText() is not always updating Jtextfield and Jlabel items Jeff Higgins <jeff@invalid.invalid> - 2015-02-26 19:43 -0500
    Re: setText() is not always updating Jtextfield and Jlabel items Kevin Nathan <knathan@project54.com> - 2015-02-27 08:21 -0700
  Re: setText() is not always updating Jtextfield and Jlabel items Knute Johnson <nospam@rabbitbrush.frazmtn.com> - 2015-02-26 20:05 -0800
    Re: setText() is not always updating Jtextfield and Jlabel items Kevin Nathan <knathan@project54.com> - 2015-02-27 08:24 -0700
  Re: setText() is not always updating Jtextfield and Jlabel items Nigel Wade <nmw@ion.le.ac.uk> - 2015-02-27 15:45 +0000
    Re: setText() is not always updating Jtextfield and Jlabel items Kevin Nathan <knathan@project54.com> - 2015-03-02 09:33 -0700

csiph-web