如何自定义格式器JFormattedTextField以显示IP地址? [英] How to custom formatter JFormattedTextField to display an IP address?

查看:135
本文介绍了如何自定义格式器JFormattedTextField以显示IP地址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试自定义JFormattedTextField以显示用于输入IP地址的掩码.

I have been trying to custom JFormattedTextField to display a mask for entering an IP address.

我阅读了Javadoc,并尝试了###.###.###.###,但在许多情况下无效.

I read javadoc, and I tried with ###.###.###.###, but it's not valid in many cases.

我为此找到了一些文章,他们使用Regex格式化值,但没有显示用于输入IP的掩码.

I found some article for this, they use Regex to format value but they don't display a mask for entering an IP.

我想在文本字段中显示3个点以显示IP地址.像这样:

I want to display 3 dots in text field to display IP address. Like this:

 .   .   .

在很多情况下,我都可以输入IP地址.您可以在Windows的IPv4配置中看到.

I can input a IP Address in many cases. You can see in IPv4 configuration in Windows.

 .   .   .

你能帮我吗?感谢您的阅读

Can you help me? Thanks for reading

推荐答案

我知道这不会帮助您完成家庭作业,但对于其他寻求解决方案的人来说:Jidesoft Grids(我不隶属于)有一个针对此: com.jidesoft.field.IPTextField .

I know this won't help you with your homework, but for other people looking for a solution: Jidesoft Grids (I am not affiliated) has a class for this: com.jidesoft.field.IPTextField.

通常,我认为使用JFormattedTextField很难获得令人满意的解决方案.

Generally, I think it will be difficult to achieve a satisfactory solution with JFormattedTextField.

这篇关于如何自定义格式器JFormattedTextField以显示IP地址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆