I have two text areas on the screen, I have made bold the different words between two text areas and I want to have a button for up and down to go the different words on the text areas. Is this possible ?
Asked
Active
Viewed 433 times
2
-
2Yes but I suggest you to be a little more precise. Post some code showing what you have tried since now. Your question is still to much vague to get an answer here. – Heisenbug Aug 10 '12 at 10:59
-
1There are many related Q&As [here](http://stackoverflow.com/users/1559593/vstl) and [here](http://stackoverflow.com/users/1573438/jes) that may help you clarify your question. – trashgod Aug 10 '12 at 11:03
-
yes you are right but I don't know any idea how i can do it, I'm still researching now, can you tell me some kind of method for that. I have found setDefaultButton now but I'm not sure that is not my solution of my problem. @Heisenbug heisenberg ehehe comes up heisenberg from breaking bad sorry im kidding :) – zenx Aug 10 '12 at 11:04
-
1Seems to me what you need is `modelToView()` and `viewToModel()`, which is inherited by `JTextArea` from `JTextComponent`. Here is one [example](http://stackoverflow.com/a/10309277/1057230) and another [example here](http://stackoverflow.com/a/10463120/1057230), that might can help you – nIcE cOw Aug 10 '12 at 13:04
1 Answers
3
have to look at JTextArea, but notice isn't designated for nice formatting or higlighting, then to use JTextPane instead
TextUtilities can help you to find out desired indexes rellative to screen or rellative to the model (Document)

mKorbel
- 109,525
- 20
- 134
- 319
-
-
1@zenx : `KeyEvent` are not a good option when it comes to Swing. ***[KeyBinding](http://docs.oracle.com/javase/tutorial/uiswing/misc/keybinding.html)*** is what goes with Swing. – nIcE cOw Aug 10 '12 at 13:07