JTextPane's getText()
and setText()
methods give you full access to the text displayed by the component. If that happens to be HTML, then the text you're dealing with is a HTML document and you need to change that HTML text just as you would if you were displaying HTML directly.
If you have an INPUT
with type="text"
or default type, then you display a text field, and its displayed value is controlled by the value=
attribute.
To do that, you need to do some in-code text editing of the text value of your JTextPane. You can use IndexOf()
to find the offset of your INPUT
tag, then again to find the value
or the closing angle bracket, and then you insert your desired value at the location you wanted.
When you have your new String all set up, put it back in the JTextPane using setText()
. Done.