overloaded text components for Swing
brien colwell
An initial version of this code is described here. Since then, I've done a bit to integrate temporal graphs using this code (e.g. graphics under entities). The design goal is to embed relevant information, much like a sparkline. This information can disambiguate entities (e.g. the John Smith with a criminal record versis the legions without) and provide temporal context for the sentence. For example, does this sentence refer to something that occurred again?
Since I was responsible for various text displays at Palantir, I thought exploring this avenue was useful. I think integrating contextual information makes reading a document easier (entity disambiguation is visual), less error prone, and more connected. However, it never materialized into the live product.
Better support for graphic generation would be a great extension to this project.
The curious should check out Example1.java for some pointers
on how to put sparklines under regions of text.
final JTextArea ta = new TokenJTextArea();
// Set up tokenizers:
final Tokenizer spellCheckTokenizer = SpellCheckTokenizer.create();
( (TokenDocument) ta.getDocument() ).getHelper().addTokenizer( spellCheckTokenizer );
( (TokenTextUI) ta.getUI() ).getHelper().addRenderer( 0,
new BasicTokenRenderer( spellCheckTokenizer,
new TokenAppearanceFactory() {
public TokenAppearance createAppearance(final Token token) {
return new TokenAppearance( Color.RED, new PerlinNoiseStroke() );
}
}, new Insets( 0, 0, 3, 0 ) ) );