Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #5454
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Jeff Higgins <jeff@invalid.invalid> |
| Newsgroups | comp.lang.java.gui |
| Subject | Re: setText() is not always updating Jtextfield and Jlabel items |
| Date | Thu, 26 Feb 2015 19:43:05 -0500 |
| Organization | A noiseless patient Spider |
| Lines | 45 |
| Message-ID | <mcoer7$bir$1@dont-email.me> (permalink) |
| References | <20150226132317.6bbbc29a@efreet.linux> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=windows-1252; format=flowed |
| Content-Transfer-Encoding | 7bit |
| Injection-Date | Fri, 27 Feb 2015 00:47:36 +0000 (UTC) |
| Injection-Info | mx02.eternal-september.org; posting-host="c50a9e5d554cfaba13eda1c71e805135"; logging-data="11867"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/HvncocvEfn1s+lFEo6kU6NNHlPbSF8Sg=" |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.4.0 |
| In-Reply-To | <20150226132317.6bbbc29a@efreet.linux> |
| Cancel-Lock | sha1:0aNcs7vM22sUoLE5lB19Y+dW9fs= |
| Xref | csiph.com comp.lang.java.gui:5454 |
Show key headers only | View raw
On 02/26/2015 03:23 PM, Kevin Nathan wrote: > > I could use some direction about where to look for this. I am still > pretty new to Java. I have a user input screen with multiple > JTextFields for user input and matching JLabels for informational > output for users. > > This is for a livestock auction system. While the animals are moving > around on the scale, the scale instrument (a serial port device) > returns an indication of "motion" that we want to show to the user. > When the motion goes away, the actual weight gets written to the Weight > JTextField. However, during the motion (which can be anywhere from > non-existent to many seconds) we want to write "Motion" in the > textfield and the actual, changing, weights in the label field. This is > what is not happening. After the motion stops, the true weight does get > written correctly, using setText(). > > The serial port routine returns an error code of -2 if there is motion > (and several other error codes that are handled correctly) and that is > what I am using. Here are some code snippets to show what is being > attempted, I hope it's enough to make sense: > Often in Swing, when the complaint involves "does not work in this instance, but works everywhere else" you've run into a thread concurrency issue. You might have a look at "Concurrency in Swing" <http://docs.oracle.com/javase/tutorial/uiswing/concurrency/index.html> if you haven't already. The section "Bound Properties and Status Methods" refers to another section in the Java Tutorials "Lesson: Writing Event Listeners" <http://docs.oracle.com/javase/tutorial/uiswing/events/index.html> which may be helpful as there was no indication in the snippets you provided that you are using the Swing event model. > > I am completely puzzled why "setText" does not work in this instance, > but works everywhere else I am using it. Thanks for any help, or > pointers to pages that may help me to understand this > >
Back to comp.lang.java.gui | Previous | Next — Previous in thread | Next in thread | Find similar
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