views:

55

answers:

2

I want to build predictive sentence advisor, like (Onion News) Apple Introduces Revolutionary New .... Sentences can probably be generated by stylized pseudo-random text generating algorithm like Markov chain.

I imagine this as - while typing, menubox with predictive sentences are displayed above text cursor.

  • How to 'text cursor track' and display menu over it
  • What is the easiest way to implement Markov chain
A: 

Maybe this link will help you to track the cursor. I'm not sure how to convert cursor position to screen coordinates, but if you do it, Popup will help you to display JList or JComboBox.

Don't know anything about Markov chain.

tulskiy
Following link seems to show how to get text character count. It does not seem to be useful. I was more like thinking some solution that does use 'StringMetrics' like class, to find string length and height (and do its thing).
Margus
A: 

Would a tool tip on the text box be sufficient? It can be recalculated on the fly.

Thorbjørn Ravn Andersen
Well i failed to think any better way, then to use taxtarea multiline tool tip with mnemonic keys.
Margus