To answer your direct question: No you can't display a JTable inside of a JTextArea, not without completely perverting the JTextArea and its functionality.
I'm not sure why you'd even want to do such of a thing, since a JTextArea displays text, and you can't display a component inside of it, not without completely messing up its functionality. That is, unless I'm misinterpreting your question, and if so, please clarify it.
What exactly are you trying to display in the JTextArea? The JTable's data? If so, that's a completely different thing. If that's the case, then sure, this can be done:
- Set the JTextArea's font to be mono-spaced
- Use String formatting via
String.format(...)
to allow you to display columns of data in a tabular fashion.
- As with any solution the details of the solution will depend on the details of the problem.