本文整理匯總了Java中javax.swing.text.AbstractDocument.setDocumentFilter方法的典型用法代碼示例。如果您正苦於以下問題:Java AbstractDocument.setDocumentFilter方法的具體用法?Java AbstractDocument.setDocumentFilter怎麽用?Java AbstractDocument.setDocumentFilter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.text.AbstractDocument
的用法示例。
在下文中一共展示了AbstractDocument.setDocumentFilter方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setLengthFilter
import javax.swing.text.AbstractDocument; //導入方法依賴的package包/類
private void setLengthFilter(JComboBox<?> cb) {
Component editorComponent = cb.getEditor().getEditorComponent();
if (editorComponent instanceof JTextComponent) {
JTextComponent tc = (JTextComponent) editorComponent;
Document document = tc.getDocument();
if (document instanceof AbstractDocument) {
AbstractDocument ad = (AbstractDocument) document;
ad.setDocumentFilter(lengthFilter);
}
}
}
示例2: init
import javax.swing.text.AbstractDocument; //導入方法依賴的package包/類
private void init() {
AbstractDocument ad = LineDocumentUtils.asRequired(document, AbstractDocument.class);
this.valid = true;
ad.setDocumentFilter(new DocFilter());
try {
// initialize the bypass:
ad.replace(0, 0, "", null);
} catch (BadLocationException ex) {
}
org.netbeans.lib.editor.util.swing.DocumentUtilities.addPriorityDocumentListener(document,
l = new DocL(), DocumentListenerPriority.CARET_UPDATE);
}
示例3: TimeTextField
import javax.swing.text.AbstractDocument; //導入方法依賴的package包/類
public TimeTextField(String initial, int cols)
{
super(initial, cols);
setHorizontalAlignment(JTextField.LEADING);
AbstractDocument doc = (AbstractDocument)getDocument();
doc.setDocumentFilter(new EasyNumFilter(3, 3));
}
示例4: IntTextField
import javax.swing.text.AbstractDocument; //導入方法依賴的package包/類
public IntTextField(String initial, int cols)
{
super(initial, cols);
setHorizontalAlignment(JTextField.LEADING);
AbstractDocument doc = (AbstractDocument)getDocument();
doc.setDocumentFilter(new EasyNumFilter(6));
}