关于MaskFormatter的错误

BillGas 2004-09-03 03:12:23
程序代码:

import javax.swing.text.*;

MaskFormatter formatter = new MaskFormatter("########");

JFormattedTextField aaa = new JFormattedTextField(formatter);

位置:new处报错

报告错误:

unreported exception java.text.ParseException; must be caught or declared to be thrown at line 21, column 29

求助!
...全文
133 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
射天狼 2004-09-03
  • 打赏
  • 举报
回复
import java.text.ParseException;//这个也要引用
射天狼 2004-09-03
  • 打赏
  • 举报
回复
要捕错错误才行!!
射天狼 2004-09-03
  • 打赏
  • 举报
回复
import javax.swing.text.MaskFormatter;

MaskFormatter formatter;
try
{
formatter = new MaskFormatter("########");
JFormattedTextField aaa = new JFormattedTextField(formatter);
}
catch (ParseException e1)
{
// TODO Auto-generated catch block
e1.printStackTrace();
}
BillGas 2004-09-03
  • 打赏
  • 举报
回复
up

62,634

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧