[RFC][Icedtea-Web]: Ensure all ports entered are numeric values
Deepak Bhole
dbhole at redhat.com
Mon Feb 28 10:27:43 PST 2011
* Omair Majid <omajid at redhat.com> [2011-02-28 13:03]:
> On 02/28/2011 11:04 AM, Andrew Su wrote:
> >>>>
> >>>>This patch ensures that the port fields in itw-settings only
> >>>>accept numeric values.
> >>>>
> >>>>In this patch: - New Class: NumberDocument. - All port fields
> >>>>now use NumberDocument.
> >>>>
> >>>>Questions? Comments? Concerns?
> >>>>
> >>>
> >>>Rather than defining a separate class, it might be better to use
> >>>JFormatterTextField to force the field to accept numbers only.
> >>>
> >>
> >>s/JFormatterTextField/JFormattedTextField
> >
> >I didn't think JFormatterTextField fits what I'm trying to do here,
> >since the value gets cleared when text field loses focus. I wanted it
> >to make sure that no "bad" inputs are given the moment it is typed.
> >
>
> Perhaps an InputVerifier might be useful? Take a look at the javadocs
> for JFormattedTextField [1] for an example.
>
InputVerifier cannot check for bad input as it is typed. It relies on
loss of focus as a verification trigger..
Deepak
> Cheers,
> Omair
>
> [1] http://download.oracle.com/javase/6/docs/api/javax/swing/JFormattedTextField.html
More information about the distro-pkg-dev
mailing list