Solved

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

Posted on 2012-03-14
8
214 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
0
Comment
Question by:taborrg
  • 4
  • 4
8 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 37719216
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
0
 
LVL 1

Author Comment

by:taborrg
ID: 37719232
Can a JTable be added to a JScrollPane?
0
 
LVL 1

Author Comment

by:taborrg
ID: 37719264
How would that be done with a monospaced font?
0
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
LVL 86

Expert Comment

by:CEHJ
ID: 37719273
Can a JTable be added to a JScrollPane?

Yes. It almost always is actually
0
 
LVL 1

Author Comment

by:taborrg
ID: 37719294
How about in the JTextarea with a monospaced font?  I actually like Couriernew.
0
 
LVL 86

Accepted Solution

by:
CEHJ earned 500 total points
ID: 37719322
Well in that case just append each line using String.format
0
 
LVL 1

Author Closing Comment

by:taborrg
ID: 37719328
Looks good,

Thanks
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 37719330
:)
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question