|
|
|
@ -26,7 +26,7 @@ public class JDateDocument extends PlainDocument{
|
|
|
|
|
** 调用者:类JDateDocument |
|
|
|
|
*******************************************************************/ |
|
|
|
|
public JDateDocument(JTextComponent tc, SimpleDateFormat dateFormat) throws |
|
|
|
|
UnsupportedOperationException { |
|
|
|
|
UnsupportedOperationException{ |
|
|
|
|
//当前日期构造
|
|
|
|
|
this(tc, dateFormat, getCurrentDate(dateFormat)); |
|
|
|
|
} |
|
|
|
@ -34,14 +34,15 @@ public class JDateDocument extends PlainDocument{
|
|
|
|
|
public JDateDocument(JTextComponent tc, |
|
|
|
|
SimpleDateFormat dateFormat, |
|
|
|
|
String initDateTime) throws |
|
|
|
|
UnsupportedOperationException { |
|
|
|
|
UnsupportedOperationException{ |
|
|
|
|
//设置当前日期格式
|
|
|
|
|
setDateFormat(dateFormat); |
|
|
|
|
//保存操作的文本框
|
|
|
|
|
textComponent = tc; |
|
|
|
|
try { |
|
|
|
|
//设置显示为当前日期,同时完成显示的格式化
|
|
|
|
|
try{ |
|
|
|
|
insertString(0, initDateTime, null); |
|
|
|
|
} catch (BadLocationException ex) { |
|
|
|
|
} catch(BadLocationException ex){ |
|
|
|
|
throw new UnsupportedOperationException(ex.getMessage()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|