如何禁用JSpinner的文本字段区域 [英] How can I disable the textfield area of JSpinner

查看:104
本文介绍了如何禁用JSpinner的文本字段区域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前在netbeans中遇到问题,我的JSpinner允许您在文本字段中键入内容,而我只希望使用箭头. 有没有一种方法可以通过属性或其他方式禁用文本输入?

I'm currently having a problem in netbeans where my JSpinner is allowing you to type in the textfield while I only want the arrows to be used. Is there a way to disable the input of text via properties or some other way?

谢谢

推荐答案

使用以下命令禁用JSpinner的JTextField:

Disable the JSpinner's JTextField's using the following:

((JSpinner.DefaultEditor) yourSpinner.getEditor()).getTextField().setEditable(false);

这篇关于如何禁用JSpinner的文本字段区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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