我是Swing的新手,我正在尝试禁用jspinner,因此它无法编辑。
我添加了一个微调器,并在属性中将模型类型更改为date。这样它就可以显示日期和时间。已将变量名称更改为“Datespin”。
我正在尝试下面的代码,但是这有助于。
我的问题:你可以帮助我使这个领域不可编辑吗?它应该在执行时显示日期和时间,但用户不应该编辑它。
private void hDateSpinnerPropertyChange(java.beans.PropertyChangeEvent evt) {
JSpinner spinner= new JSpinner();
JFormattedTextField spin=((JSpinner.DefaultEditor)spinner.getEditor()).getTextField();
spin.setEditable(false);
我哪里错了?
答案 0 :(得分:2)
您正在重新创建此事件的微调器,但您已经有一个可见的// We'll be outputting a PDF
header('Content-Type: application/pdf');
// It will be called downloaded.pdf
header('Content-Disposition: attachment; filename="downloaded.pdf"');
实例。因此,您需要使用它而不是与GUI没有任何链接的新实例
所以这应该是这样的:
Datespin