Help write your own javax swing. text. Document

I am writing a Java textcomponent in which the underlying document has some structure It's very short, basically one line I need a response that can override the insertion or deletion of characters in some parts of the document

My initial approach was to implement javax swing. text. Document, but this seems to involve developing many related classes (element, editorkit, view), and there doesn't seem to be many examples or tutorials on how to perform this operation There are many ways to use predefined implementations

Anyone can point to my tutorial or other aids to simply implement document and what other classes I need to create to make it work

Solution

If you only want to respond to character insertion / deletion, documentfilter may be a better method This will allow you to block the insertion of characters in the document you want Read the jtextfield API and follow the swing tutorial link in "text component functions" for more information

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>