Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to use insert() with JTextArea  RSS feed

 
Dave Johnson
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here are the more relavent parts of my code:

What I wanted to do was add an int after the String on every line follow by a double on every line, both at specific columns. So the int could be added at column 12 and the double could be added at column 18 for example.
Bitter 3 2.04
I tried using the insert() String, int position, but I must be doing something wrong.
Please help if you can.
Thanks, Dave.
 
Joe Ess
Bartender
Posts: 9406
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JTextArea.insert() inserts a String at the given index within the String in the text area. It does not position a string at a column position, which is how I think you are trying to use it. If you want to position your text within the JTextArea you will have to pad the various Strings manually.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!