Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Clickable text within a pane?  RSS feed

 
D.A. Briggs
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm developing a tool for people to learn how to parse logic expressions with a large variety of boolean(including quantifiers) and numerical
operators. The plan is to generate a random expression, then ask the user to click on the operator at the root, then recursively throw up another
panel(s) with the subexpressions and again ask the user to click on the operator that should be at the root.

At present my notion is to put each token in a JLabel within a panel, since the label will be clickable.

Is there any way I could put the text in a text box or text area and have the user click on the characters within the text box? I expect I could
do this in javascript by making the displayed formula into an image file and mapping the token coordinates, and I thought Java might offer
something comparable.
 
K. Tsang
Bartender
Posts: 3628
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

Major BatGuano wrote:I'm developing a tool for people to learn how to parse logic expressions with a large variety of boolean(including quantifiers) and numerical
operators. The plan is to generate a random expression, then ask the user to click on the operator at the root, then recursively throw up another
panel(s) with the subexpressions and again ask the user to click on the operator that should be at the root.

At present my notion is to put each token in a JLabel within a panel, since the label will be clickable.

Is there any way I could put the text in a text box or text area and have the user click on the characters within the text box? I expect I could
do this in javascript by making the displayed formula into an image file and mapping the token coordinates, and I thought Java might offer
something comparable.


From what I see, a JTree (<- click) may be more appropriate rather than having JLabels on JPanels. JTree's items are surely selectable / clickable.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!