I'm trying to get the IP address in JTextField like 127.0.0.1 (for client to connect Server). I used new MaskFormatter("###.###.###.###") but it doesn't work properly in many cases. Do i need to write some code to get proper input or you guys can tell any better solution.
I'm also considering of taking input in 4 text boxes but i'll wait for your valueable suggestions.
Champion, in my case, here's what I did: I simply provided a JTextField for the user to provide the server's IP address (and the user can provide really anything). Before trying to connect, I verify if the user provided a valid IP address (by using regular expression); if so, then the client tries to connect to the server, otherwise, a message box, saying that the provided IP address is invalid, is displayed.