I'm studying about the structure of text components in Swing programs.
As far as I understand, JTextComponent
is essentially divided into a view and a model. The model is an instance of a class implementing Document
, containing all of the text and offering ways to manipulate it, and the View presenting the text visually.
However I don't understand exactly where, how and why an EditorKit
is used. I'm not sure if it encapsulates ('owns') the model (Document
), or if the Document encapsulates it. And not sure where the view fits inside all of this.
So two questions:
1- Please describe the relations between the view, Document
and EditorKit
in JTextComponents
. What encapsulates what, what interacts with what, and why?
2- Please explain the functionality and role of EditorKit
.
Thank you for your help
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…