We help IT Professionals succeed at work.

set the horizontal position where text will be added in JTextarea?

taborrg
taborrg asked
on
Medium Priority
269 Views
Last Modified: 2012-06-27
Hi,

Is there a way to set the horizontal position where text will be added in JTextarea?

I have:
First, Middle, Last name and then Company name.
Ex.
Jay F. Bar                                 Some Company
Ron  G.  McDonald               Some Other Company

I can't get the company names to line up using "\t" - can I set the insertion point for the company name to some line position?

Thanks
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2016

Commented:
Save yourself a lot of hassle (you can only do what you're attempting by using an ugly monospaced font anyway) by using a JTable

Author

Commented:
Can a JTable be added to a JScrollPane?

Author

Commented:
How would that be done with a monospaced font?
CERTIFIED EXPERT
Top Expert 2016

Commented:
Can a JTable be added to a JScrollPane?

Yes. It almost always is actually

Author

Commented:
How about in the JTextarea with a monospaced font?  I actually like Couriernew.
CERTIFIED EXPERT
Top Expert 2016
Commented:
Well in that case just append each line using String.format

Author

Commented:
Looks good,

Thanks
CERTIFIED EXPERT
Top Expert 2016

Commented:
:)

Explore More ContentExplore courses, solutions, and other research materials related to this topic.