Results 1 to 6 of 6
- 04-08-2008, 01:55 PM #1
[SOLVED] Last line in JTextArea wont display
I have a JTextArea that is displaying decoded signals that are stored in a file. The file is updated periodically during the execution of the program. I fire periodic updates to the textarea, but every time the last line of the file is not shown. If i do a copy/paste to notepad the last line shows, or if i copy the text from the textarea to another textarea it shows up just fine. Any idea what would cause this or any kind of work around? I tried just keeping the textarea in the background and copying the contents to a new one that is visible, but the data in this textarea can get infinitely large and doubling that would be unfavorable.
Thanks,
Chris
- 04-09-2008, 05:24 AM #2
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Are you sure that not misses the last line when you extract/read data from the file?
- 04-09-2008, 06:03 AM #3
That is the thing that i am currently checking. We wrote the underlying document structure and there may be an error in getting the length of the file. I was just wondering if anyone has heard of this issue where it wouldn't be my boss's fault.
- 04-10-2008, 05:40 PM #4
Underlying structure didn't increase the document length in the statement
If(isLast()){
break;
}
All fixed.
- 04-11-2008, 06:13 AM #5
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Did you read line-by-line of the file? If so, why don't you use readLine() method?
- 04-11-2008, 01:52 PM #6
The project that i am on reads signals from a semi truck and translates the binary to hex then to english. It saves all of the signals in a text area that is backed up by a text document. These signals come across the wire at about 100 per second making this file grow very fast. We rewrote the document class so that we could cache lines and find which one is closest to the line we want then work from there. Reading an 8 gig file line by line to find one line is not very efficient. But in the function getLength() the counter was incremented for each line, but was never incremented for the last line before the break. Two and a half weeks of work to find that one in the middle of a 15 function stack trace. I'm just glad that hell is over. On to the next bug...
Similar Threads
-
[SOLVED] Delete Current line from file
By Azndaddy in forum New To JavaReplies: 2Last Post: 04-06-2012, 08:00 AM -
problem trying to display the contents of a text file in JTextArea
By warship in forum New To JavaReplies: 17Last Post: 07-13-2009, 05:44 AM -
[SOLVED] Line number: ?
By Azndaddy in forum New To JavaReplies: 1Last Post: 04-04-2008, 05:46 AM -
Display Line# and Column# in JSP
By loganathan.lakshmanan in forum JavaServer Pages (JSP) and JSTLReplies: 3Last Post: 01-17-2008, 12:37 PM -
How to always show the last line in my JTextArea?
By Ashley in forum New To JavaReplies: 1Last Post: 05-26-2007, 01:01 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks