为什么JFormattedTextField是邪恶的? [英] Why is JFormattedTextField evil?

查看:122
本文介绍了为什么JFormattedTextField是邪恶的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这个问题有吗任何方式只接受JTextField中的数值?其中一个答案表明JFormattedTextField存在问题。

In this question Is there any way to accept only numeric values in a JTextField? one of the answers suggested that JFormattedTextField had issues.

我还没有使用它,但可能有人请扩展(或不同意)这个类的问题吗?

I've not yet used it, but could somebody please expand (or disagree) on the issues with this class?

推荐答案

JFormattedTextField 是邪恶的。例如,如果文本字段只能接受整数值, JFormattedTextField 将允许任何旧垃圾,然后在焦点丢失时进行投诉。更糟糕的是,当焦点丢失时,它有一系列可配置的行为(一个明显的迹象表明它们都不是正确的选择)。

JFormattedTextField is evil because of poor usability. For instance, if a text field should only be able to accept an integer value, JFormattedTextField will allow any old rubbish and then complain when focus is lost. To make matters worse, it has a range of configurable behaviours when focus is lost (a clear sign that none of them is the correct choice).

它还有k3wl格式化程序选择。它似乎与文档的交互性很差(它试图安装 DocumentFilter ,但这不是文档的一部分 interface)。

It also has "k3wl" formatter selection. It also seems to have poor interaction with the document (it tries to install a DocumentFilter, but that is not part of the Document interface).

这篇关于为什么JFormattedTextField是邪恶的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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