I want to have a method like this on my DocumentFilter
public void replaceUpdate(int offset, int length, String text) {
try {
super.replace(byPass, offset, length, text, null);
} catch (BadLocationException ex) {
//error
}
}
Currently in order to get an instance of FilterBypass (byPass on method above) , I need to get from the overridden method insertString :
private FilterBypass byPass;
@Override
public void insertString(DocumentFilter.FilterBypass fb,
int offset, String string, AttributeSet att)
throws BadLocationException {
byPass = fb;
//some stuff here
super.insertString(fb, offset, string, att);
}
But this is causing me some problems. Can anyone suggest some different way of getting a FilterBypass? I can't find a way to get a reference to the FilterBypass
differently.
If I was to override its methods how should it be?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…