Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Nigel Wade Newsgroups: comp.lang.java.programmer Subject: Re: JavaFX: Bindings, StringConverters, and ChangeListeners Date: Thu, 23 Jun 2016 12:19:18 +0100 Lines: 32 Message-ID: References: <87wplhbbvy.fsf@gnu.org> <877fdgl87c.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net JBbK6EYmRrYDY0s7xnAPFA6dVdIXgIEMl1i5zOzRCAUEuNLUIf Cancel-Lock: sha1:atGkH2gpsNm+vTxPOeV/HupcJ5c= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.0 In-Reply-To: Xref: csiph.com comp.lang.java.programmer:34696 On 23/06/16 10:59, Martin Gregorie wrote: > On Thu, 23 Jun 2016 08:39:51 +0200, Tassilo Horn wrote: > >> Oh, flashing is actually a nice idea and can be done pretty easily from >> my listener. >> > Personal view: flashing is annoying if its more than a single character > that's doing it. I've recently used black on white for normal Swing > JTextField data entry fields and, if invalid/inappropriate/out of range, > setting that to white text on red as an alert. If the rest of the > window's palette is no closer to red than pastel yellow, its quite eye- > catching. > > Actually this is numeric with the field in question being a total of > several inputs. The colours I used were: > - black on white = total too low > - green on white = total exactly right > - white on red = total too high > > You need to be careful with colours. I've had issues with UIManager overriding my colours because it decided there was insufficient contrast between the foreground and background. I'd very carefully chosen the colours so that there was sufficient contrast, but the UIManager had other ideas. As far as I could tell the UIManager only compares the light/darkness of the colours, and doesn't take proper account of the colour contrast. I have no idea if this is similar in JavaFX, my Java GUI work is with Swing. I find that a single flash is not too intrusive. It's a reasonable indication to the user that there is something wrong with the input somewhere on the dialog. Then a field highlight can be used to give feedback as to which actual field is incorrect.