Re: Can JOptionPane use a MaskFormatter for data input



Deniz Dogan schrieb:
dcMan wrote:
I would like to have a dialog box that prompts the user for an IP
address. Is there a way to use JOptionPane, but have the data entry
text box restrict the input to be ###.###.###.###?

Thanks
Greg

I haven't got an answer, in fact I'm bumping this one, because I need to know the same thing. There SHOULD be such a thing I reckon, this is Java after all. ;-)

You may use a JFormattedTextField (using a MaskFormatter) and you may further use this text field as message parameter to call any of the JOptionPane.showXXXDialog methods.

Instead of using JOptionPane you can of course use a JDialog, too.

Bye
Michael
.



Relevant Pages