Well, this is 7th edition of this excellent book and someone should have already highlighted that when a filter of DocumentFilter class works
1) replace() is called most of the time on user’s interaction with e.g. text field, not just when ‘text is selected and replaced’ but also on regular input and
2) contrary to what can be concluded from previous paragraph (it may mislead), insertString() is called on text inserted to document on construction of the e.g. text field object (as constructor parameter) or ‘injected’ to document by document.insertString()

Have a look at the original text would you think it shows clear understanding of the process? What do you think, am I too sensitive on this? I found this pretty confusing.

Recommended Answers

All 2 Replies

If you have qualms with the clarity of the writing in the book, or with a particular bug in the code in the book, then why not email the publisher? Of course, the writing might be clear to some people but not to others: your claim that it is unclear is important and perfectly valid, even if someone else thinks that it is clear.

Thank you for your opinion.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.