将JText字段值绑定到Info类 [英] Binding of JText fields value to Info Class
本文介绍了将JText字段值绑定到Info类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有什么方法可以将Swing JTextFields自动绑定到Info类.例如
Is there any way to automatic binding of Swing JTextFields to Info Class. e.g
private JTextField receiptId;
private JTextField Id;
public class Info {
private string receiptId;
private String id;
// Getters and Setters
}
当我从Swing页面输入值然后值自动绑定到Info类时,有什么办法吗?之后,我可以将我的Info对象传递给其他类,而不是发送所有文本字段.
Is there any way when I entered values from Swing page then automatically values bind with my Info class? After that I can pass my Info object to other classes instead of sending all Text Fields.
推荐答案
此绑定"通常使用从在每个JTextFields
中注册的侦听器中调用设置器Info.setReceiptId()
和Info.setId()
.
Call your setters Info.setReceiptId()
and Info.setId()
from the listeners registered with each of your JTextFields
.
这篇关于将JText字段值绑定到Info类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文