JDialog中的Cancel按钮如何重置组件值

时间:2016-05-22 19:07:41

标签: java swing jdialog

考虑我在JDialog中有3个文本字段和3个复选框,带有“确定”和“取消”按钮。我更新了组件(在2个文本字段中输入了值,在选定状态下输入了2个复选框)并单击了“取消”按钮。组件值需要重置。是否使用以下编码方式执行取消操作?

在JDialog开幕活动中,

$("#start-date").datepicker("getDate");

在取消活动中,

String str_txtf1 = txtfld1.getText();
String str_txtf2 = txtfld2.getText();
String str_txtf3 = txtfld3.getText();

boolean chbox1 = chkbox1.isSelected();
boolean chbox2 = chkbox2.isSelected();
boolean chbox3 = chkbox3.isSelected();

0 个答案:

没有答案