Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Grouping text in JTextArea  RSS feed

 
Richard Robbins
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am writing an application using a JTextArea, and I need to group text together so that a whole section is treated as a single object. I am creating messages which can have parameters substituted into them. These parameters are kept in a JComboBox. For instance, a message could look like this:
Hello <salutation> <lname>...
The parameters (salutation and lname) would be entered by selecting the parameter from the JComboBox and clicking a JButton, whereupon the parameter is entered into a message. I need a mechanism such that if a user decides to remove the parameter, he can move the cursor to the end of the parameter and hit backspace, and the whole parameter will be removed. In other words, this should not be possible:
Hello <salut... >
because the <salutation> parameter is grouped together and treated as if it were a single character/object. Any ideas?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!