Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #34700
| From | Eric Sosman <esosman@comcast-dot-net.invalid> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: JavaFX: Bindings, StringConverters, and ChangeListeners |
| Date | 2016-06-23 08:22 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <nkgkao$k1b$1@dont-email.me> (permalink) |
| References | <87wplhbbvy.fsf@gnu.org> <cf173549-4d73-4f6a-9d3f-031a070ce34c@googlegroups.com> <8737o4l7xo.fsf@gnu.org> <cfe580ca-be4d-48db-9cdb-6ae8d059511c@googlegroups.com> |
On 6/23/2016 8:11 AM, Eric Douglas wrote:
> On Thursday, June 23, 2016 at 2:45:49 AM UTC-4, Tassilo Horn wrote:
>> Yes, that's what I did in Swing, too. And the FX ChangeListeners are
>> not too different. At least, they are called on any key the user typed
>> into the text field. My problem is more on the part on when the
>> binding's string-to-integer converter is invoked. When entering text in
>> the middle or end, it'll be called after my listener (good!) but when
>> entering text at the front, it'll be called before my listener (bad!).
>
> It should be more than key typed. The input filters for JTextField give you character added or removed event which could be a key type, copy/paste, or drag/drop. This should happen before any listeners.
>
> I write custom controls extending Swing GUI which have their own listeners. I add a listener interface array so I can manually tell my custom listeners when an event has occurred. I had some issues with JTable returning the events in an odd order, so I'd store an event which normally follows another event and pass it to the listeners after I get the other event.
FWIW, in Swing applications I've had good experiences with using
an InputVerifier. Or, perhaps, "misusing" it: I don't use the verify()
method at all, but override shouldYieldFocus() instead. If the content
is invalid, my shouldYieldFocus() returns false and the user quickly
discovers that he's stuck in the field until he corrects it.
I'm not FXliterate, so I don't know whether there's an analog.
Could be worth a look, though.
--
esosman@comcast-dot-net.invalid
"Don't be afraid of work. Make work afraid of you." -- TLM
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
JavaFX: Bindings, StringConverters, and ChangeListeners Tassilo Horn <tsdh@gnu.org> - 2016-06-22 15:18 +0200
Re: JavaFX: Bindings, StringConverters, and ChangeListeners Nigel Wade <nmw@ion.le.ac.uk> - 2016-06-22 15:22 +0100
Re: JavaFX: Bindings, StringConverters, and ChangeListeners Tassilo Horn <tsdh@gnu.org> - 2016-06-23 08:39 +0200
Re: JavaFX: Bindings, StringConverters, and ChangeListeners Martin Gregorie <martin@address-in-sig.invalid> - 2016-06-23 09:59 +0000
Re: JavaFX: Bindings, StringConverters, and ChangeListeners Nigel Wade <nmw@ion.le.ac.uk> - 2016-06-23 12:19 +0100
Re: JavaFX: Bindings, StringConverters, and ChangeListeners Nigel Wade <nmw@ion.le.ac.uk> - 2016-06-23 12:39 +0100
Re: JavaFX: Bindings, StringConverters, and ChangeListeners Tassilo Horn <tsdh@gnu.org> - 2016-06-23 14:39 +0200
Re: JavaFX: Bindings, StringConverters, and ChangeListeners Eric Douglas <e.d.programmer@gmail.com> - 2016-06-22 08:06 -0700
Re: JavaFX: Bindings, StringConverters, and ChangeListeners Tassilo Horn <tsdh@gnu.org> - 2016-06-23 08:45 +0200
Re: JavaFX: Bindings, StringConverters, and ChangeListeners Eric Douglas <e.d.programmer@gmail.com> - 2016-06-23 05:11 -0700
Re: JavaFX: Bindings, StringConverters, and ChangeListeners Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-06-23 08:22 -0400
Re: JavaFX: Bindings, StringConverters, and ChangeListeners Tassilo Horn <tsdh@gnu.org> - 2016-06-23 15:12 +0200
Re: JavaFX: Bindings, StringConverters, and ChangeListeners Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-06-23 10:56 -0400
csiph-web