如何使jtextfield具有固定的日期格式? [英] how to make a jtextfield having a fixed date format?

查看:134
本文介绍了如何使jtextfield具有固定的日期格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法使用 JTextField 创建固定的日期格式。有没有办法让 JTextField 有固定的日期格式?

I'm having trouble creating a fixed date format using JTextField. Is there a way for JTextField to have a fixed date format ?

推荐答案

您可以使用JFormattedTextField与 SimpleDateFormat

You can use JFormattedTextField with SimpleDateFormat

DateFormat format = new SimpleDateFormat("your_format");
JFormattedTextField dateTextField = new JFormattedTextField(format);

这篇关于如何使jtextfield具有固定的日期格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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