I implement a mini word processor using JTextPane in Java. I created a tool bar that makes me be able to bold, underline, and color the texts which the users can input.
Now I insert a JTable into this JTextPane and I hope to be able to do what I can do outside the table. Can I do that? Using cell renderer and editor to introduce the outside environment? Or use LayerUI to draw a table on the top of the JTextPane? I can draw, but how to edit in the image?
I am a new beginner in Java programming. If you can give me some hints, I would appreciate it very very much!
What I expect is that I can type in the JTable and apply bold, italic, underline and color changes, even add bullets, etc.
A JTable is a component, not text. It cannot be styled using document styling.
You can, however, install an HTMLEditorKit on your JTextPane, which allows you to add HTML table to your document. An HTML table is comprised of text, so you can apply styles to it: