Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #34694
| From | Tassilo Horn <tsdh@gnu.org> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: JavaFX: Bindings, StringConverters, and ChangeListeners |
| Date | 2016-06-23 08:45 +0200 |
| Organization | University Koblenz-Landau Campus Koblenz |
| Message-ID | <8737o4l7xo.fsf@gnu.org> (permalink) |
| References | <87wplhbbvy.fsf@gnu.org> <cf173549-4d73-4f6a-9d3f-031a070ce34c@googlegroups.com> |
Eric Douglas <e.d.programmer@gmail.com> writes: Hi Eric, >> To prevent the user from entering invalid input, the textProperty() >> also has a ChangeListener that resets to the old value in case the >> new value cannot be parsed to an Integer. > > Revert to old value? Revert to old value in this case basically means the user types a key and the value does not change. > You don't want a user to be able to type something and see what they > typed then change it on them. Well, I think in this case it's not too bad, especially if the field flashes when invalid input is entered. > I don't know much about Java FX, I write Swing and have only needed > the FX for the WebView, but for a numeric entry allowing only valid > numbers I've used JTextField with a custom input filter. The input > filters process every character they try to add to or remove from the > control before adding or removing it. 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!). Bye, Tassilo
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