Anybody know of a free custom swing component that represents an IP address.
Or does anybody know how to format a JTextField to only allow ip addresses.
So basically I want to keep it in the form 192.168.1.101.
Any suggestions
Thanks
>:Anybody know of a free custom swing component that represents an IP address.
>:Or does anybody know how to format a JTextField to only allow ip addresses.
[quoted text clipped - 3 lines]
>:
>:Thanks
Personally, I would suggest using four fields instead of one, where each
individual field can contain values ranging from 000 to 255 and perhaps
typing the third digit could even auto-tab out to the next field.
It would be far easier to write a single JTextField subclass that
accepts only numeric input and only a max set of digits, etc. You can
easily display these in such a way that the dots appear between them on
other components. And with a little experimentation, you might even be
able to set up other restrictions if needed, like not allowing 000 in
certain octets.
= Steve =

Signature
Steve W. Jackson
Montgomery, Alabama
Symon - 27 Jan 2005 21:47 GMT
You can attach a specialized document to your textfield. Or use the
JFormattedTextField with a MaskFormatter.
>>:Anybody know of a free custom swing component that represents an IP address.
>>:Or does anybody know how to format a JTextField to only allow ip addresses.
[quoted text clipped - 16 lines]
>
> = Steve =
Paul Tomblin - 27 Jan 2005 22:35 GMT
In a previous article, Symon <symon@tatouage.fr> said:
>You can attach a specialized document to your textfield. Or use the
>JFormattedTextField with a MaskFormatter.
I know of no way to make JFormattedTextField with a MaskFormatter restrict
to a maximum value. It would be hard enough to do what I want (for
entering times, restrict the minutes and seconds parts to 00-59), but it
would be much, much harder to restrict a field to 0-255.

Signature
Paul Tomblin <ptomblin@xcski.com> http://xcski.com/blogs/pt/
I haven't had any mail from my mother since her ISP ended up in the RBL.
I deny that I nominated them...
-- Peter Corlett
> Anybody know of a free custom swing component that represents an IP address.
> Or does anybody know how to format a JTextField to only allow ip addresses.
[quoted text clipped - 3 lines]
>
> Thanks
I think this covers the subject pretty well:
http://java.sun.com/developer/JDCTechTips/2001/tt1120.html
The 4th way (MVC) is probably the best for this case.

Signature
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : nmw@ion.le.ac.uk
Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555