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?