什么是“好方法”?订阅 JFormattedTextField 中的值更改?

发布于 2024-09-11 23:00:53 字数 146 浏览 2 评论 0原文

我想订阅 JFormattedTextField 上的值更改。

检查源代码,我唯一看到的是属性“value”被新值触发。但这个属性只是在那里被引用,并且是直接写的,没有常量。如果我订阅此属性更改,它就会起作用。

但是,我想知道:这是正确的方法吗?

I want to subscribe to value changes on a JFormattedTextField.

Checking the source code, the only thing I see is that the property "value" is fired on a new value. But this property is only referenced there, and directly written, without a constant. If I subscribe to this property change, it works.

However, I'm wondering: is this the correct way to do that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

怪我鬧 2024-09-18 23:00:53

JFormattedTextField 的 JavaDoc状态[:

一旦 JFormattedTextField 被
创建完毕,可以收听编辑
通过添加的方式进行更改
PropertyChangeListener 和监听
对于 PropertyChangeEvents 来说
属性名称值。

这说明你使用的方法是正确的

JavaDoc for JFormattedTextField states[:

Once a JFormattedTextField has been
created, you can listen for editing
changes by way of adding a
PropertyChangeListener and listening
for PropertyChangeEvents with the
property name value.

That means that you are using the correct way

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文