Synchronizing tool bar and document
Font formatting controls in the tool bar not only allow to act on certain font settings in a document, they should also be used to reflect the settings at the current caret position. Class FrmMain implements interface CaretListener for doing this.
Method caretUpdate
Method caretUpdate in class FrmMain calls method updateFormatControls (see below) whenever the caret changes in the curently active document. updateFormatControls is called by FontAction too because this action also changes font attributes but the caret position does not change in this case.
caretUpdate is registered with every newly opened or created document through method registerDocument. Method unregisterDocument takes care of removing any listener when a document is closed.
Method updateFormatControls
updateFormatControls gets the attributes for the current caret position and calls method setValue of any FontComponents found in the format tool bar.