如题,看到window里面有这样的控件,特来讨教。
谢谢!
谢谢!
解决方案 »
- 在java里写了个往oracle里插值的代码,但是执行不成功?
- 点击按钮改变背景颜色
- Swing界面排版问题
- 正则表达式
- 为什么不显示jScrollPane1?偶是新手,帮忙看下
- 我愿送500分求解JAVA问题!!!!!!
- 请问大家微软给的jdbc驱动对sql-server开发人员版支持吗?
- 如何实现:b/s结构,前台给参数,后台读取数据库生成数据,返回数据到前台,前台根据返回的数据生成报表和图表?
- 如何去编译循环定义??
- j2sdkee1.3 和 weblogic,websphere这些应用服务器有什么不同?
- 关于RowSet的问题(急)
- 高分求解程序设计问题,有点难,请高手们前来帮忙想想办法
我没试过,估计可以做到:)
JFrame f = new JFrame("JFormattedTextField Sample");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Container content = f.getContentPane();
content.setLayout(new BoxLayout(content, BoxLayout.PAGE_AXIS));
// Four-digit year, followed by month name and day of month,
// each separated by two dashes (--)
DateFormat format =
new SimpleDateFormat("yyyy--MMMM--dd");
DateFormatter df = new DateFormatter(format);
JFormattedTextField ftf1 = new
JFormattedTextField(df);
ftf1.setValue(new Date());
content.add(ftf1);
// US Social Security number
MaskFormatter mf1 =
new MaskFormatter("###-##-####");
mf1.setPlaceholderCharacter('_');
JFormattedTextField ftf2 = new
JFormattedTextField(mf1);
content.add(ftf2);
// US telephone number
MaskFormatter mf2 =
new MaskFormatter("(###) ###-####");
JFormattedTextField ftf3 = new
JFormattedTextField(mf2);
content.add(ftf3);
f.setSize(300, 100);
f.show();
import javax.swing.*;
import javax.swing.text.*;
import java.util.*;
import java.text.*;