J
Jacques-Henri
Assume I have a class inherited from JTextComponent. I don't know what type
of Document will be used as its model, however I want to add functionnality
in the insertString() method of this Document instance.
How do I do this?
If that's not clear, I'd like to do something like this:
public class MyTextComponent extends JTextComponent {
...
protected Document createDefaultModel() {
return super.createDefaultModel() { // doesn't work, ofc
public void insertString(int offset, String str, AttributeSet a)
{
doSomething();
super.insertString(offset, str, a);
}
};
}
}
of Document will be used as its model, however I want to add functionnality
in the insertString() method of this Document instance.
How do I do this?
If that's not clear, I'd like to do something like this:
public class MyTextComponent extends JTextComponent {
...
protected Document createDefaultModel() {
return super.createDefaultModel() { // doesn't work, ofc
public void insertString(int offset, String str, AttributeSet a)
{
doSomething();
super.insertString(offset, str, a);
}
};
}
}