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?