[RFC][Icedtea-Web]: Ensure all ports entered are numeric values

Omair Majid omajid at redhat.com
Mon Feb 28 09:25:29 PST 2011


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.

Cheers,
Omair

[1] 
http://download.oracle.com/javase/6/docs/api/javax/swing/JFormattedTextField.html



More information about the distro-pkg-dev mailing list