public class JDateDocument
extends javax.swing.text.PlainDocument
javax.swing.text.AbstractDocument.AbstractElement, javax.swing.text.AbstractDocument.AttributeContext, javax.swing.text.AbstractDocument.BranchElement, javax.swing.text.AbstractDocument.Content, javax.swing.text.AbstractDocument.DefaultDocumentEvent, javax.swing.text.AbstractDocument.ElementEdit, javax.swing.text.AbstractDocument.LeafElement
构造器和说明 |
---|
JDateDocument(javax.swing.text.JTextComponent tc,
java.text.SimpleDateFormat dateFormat)
函数名称:JDateDocument
功能描述:设置此文本框显示的默认值、格式限制和当前日期
入口参数:
tc : JTextComponent类型,当前操作的文本框
dateFormat : SimpleDateFormat类型,当前操作文本框的格式限制
initDateTime : String类型,当前日期
返回值:无
调用者:类JDateDocument
|
JDateDocument(javax.swing.text.JTextComponent tc,
java.text.SimpleDateFormat dateFormat,
java.lang.String initDateTime) |
限定符和类型 | 方法和说明 |
---|---|
static java.lang.String |
getCurrentDate(java.text.SimpleDateFormat smFormat)
取得当前系统日时
|
java.text.SimpleDateFormat |
getDateFormat()
取得当前日期格式
|
void |
insertString(int offset,
java.lang.String s,
javax.swing.text.AttributeSet attributeSet)
函数名称:public void insertString(int offset, String s,
AttributeSet attributeSet) throws BadLocationException
功能描述:重载原方法,限制用户插入格式为日期格式
入口参数:offset: int型,插入位置
s: String型,插入字符串
attributeSet: AttributeSet型,属性集
返回值:无
调用者:类JDateDocument
|
void |
remove(int offset,
int length)
函数名称:public void remove(int offset, int length) throws BadLocationException
功能描述:重载原方法,删除合适位置的字符串
入口参数:offset: int型,插入位置
length: int型,删除长度
返回值:无
调用者:insertString(int, String,AttributeSet)
|
void |
setDateFormat(java.text.SimpleDateFormat dateFormat)
设置当前日期格式
|
createDefaultRoot, getDefaultRootElement, getParagraphElement, insertUpdate, removeUpdate
addDocumentListener, addUndoableEditListener, createBranchElement, createLeafElement, createPosition, dump, fireChangedUpdate, fireInsertUpdate, fireRemoveUpdate, fireUndoableEditUpdate, getAsynchronousLoadPriority, getAttributeContext, getBidiRootElement, getContent, getCurrentWriter, getDocumentFilter, getDocumentListeners, getDocumentProperties, getEndPosition, getLength, getListeners, getProperty, getRootElements, getStartPosition, getText, getText, getUndoableEditListeners, postRemoveUpdate, putProperty, readLock, readUnlock, removeDocumentListener, removeUndoableEditListener, render, replace, setAsynchronousLoadPriority, setDocumentFilter, setDocumentProperties, writeLock, writeUnlock
public JDateDocument(javax.swing.text.JTextComponent tc, java.text.SimpleDateFormat dateFormat) throws java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationException
public JDateDocument(javax.swing.text.JTextComponent tc, java.text.SimpleDateFormat dateFormat, java.lang.String initDateTime) throws java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationException
public void setDateFormat(java.text.SimpleDateFormat dateFormat)
dateFormat
- SimpleDateFormatpublic java.text.SimpleDateFormat getDateFormat()
public static java.lang.String getCurrentDate(java.text.SimpleDateFormat smFormat)
public void insertString(int offset, java.lang.String s, javax.swing.text.AttributeSet attributeSet) throws javax.swing.text.BadLocationException
insertString
在接口中 javax.swing.text.Document
insertString
在类中 javax.swing.text.PlainDocument
javax.swing.text.BadLocationException
public void remove(int offset, int length) throws javax.swing.text.BadLocationException
remove
在接口中 javax.swing.text.Document
remove
在类中 javax.swing.text.AbstractDocument
javax.swing.text.BadLocationException