如何接受JTextField中的单个数字[] [] num = new JTextField [9] [9] [英] How to accept a single digit number in a JTextField[][] num = new JTextField[9][9]

查看:53
本文介绍了如何接受JTextField中的单个数字[] [] num = new JTextField [9] [9]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何接受JTextField中的单个数字[] [] num = new JTextField [9] [9];



i尝试使用

num.getMaximumLength();

|| num.setMaximumLength();
来自预定义函数的
,但它不起作用!

解决方案

为受尊重的JTextField设置文档。你需要创建一个PlainDocument的子类,它基本上保持长度限制的逻辑(或者你想要的任何其他逻辑)



这是参考链接click

How to accept a single digit number in a JTextField[][] num = new JTextField[9][9];

i tried using
num.getMaximumLength();
|| num.setMaximumLength();
from predefined functions, but it is not working!

解决方案

Set document for the respected JTextField. You need to create a subclass of PlainDocument which basically hold the logic for length restriction(or any other logic if you want)

Here is the reference link click


这篇关于如何接受JTextField中的单个数字[] [] num = new JTextField [9] [9]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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