Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-08-2008, 02:55 PM
Chris.Brown.SPE's Avatar
Member
 
Join Date: Apr 2008
Location: State College, PA
Posts: 50
Rep Power: 0
Chris.Brown.SPE is on a distinguished road
Send a message via AIM to Chris.Brown.SPE
Default [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
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 04-09-2008, 06:24 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,481
Rep Power: 11
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Default
Are you sure that not misses the last line when you extract/read data from the file?
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
Someone helped you? their helpful post.
Help:Forums FAQ|How To Ask Questions The Smart WayResources:The Java Tutorials|Glossary for Java|NetBeans IDE|Sun DownloadsWeb:WritOnceTips:Is your IDE the best?|Which Application Server?
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 04-09-2008, 07:03 AM
Chris.Brown.SPE's Avatar
Member
 
Join Date: Apr 2008
Location: State College, PA
Posts: 50
Rep Power: 0
Chris.Brown.SPE is on a distinguished road
Send a message via AIM to Chris.Brown.SPE
Default
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.
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 04-10-2008, 06:40 PM
Chris.Brown.SPE's Avatar
Member
 
Join Date: Apr 2008
Location: State College, PA
Posts: 50
Rep Power: 0
Chris.Brown.SPE is on a distinguished road
Send a message via AIM to Chris.Brown.SPE
Default
Underlying structure didn't increase the document length in the statement

If(isLast()){
break;
}

All fixed.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 04-11-2008, 07:13 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 7,481
Rep Power: 11
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Default
Did you read line-by-line of the file? If so, why don't you use readLine() method?
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
Someone helped you? their helpful post.
Help:Forums FAQ|How To Ask Questions The Smart WayResources:The Java Tutorials|Glossary for Java|NetBeans IDE|Sun DownloadsWeb:WritOnceTips:Is your IDE the best?|Which Application Server?
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 04-11-2008, 02:52 PM
Chris.Brown.SPE's Avatar
Member
 
Join Date: Apr 2008
Location: State College, PA
Posts: 50
Rep Power: 0
Chris.Brown.SPE is on a distinguished road
Send a message via AIM to Chris.Brown.SPE
Default
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...
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem trying to display the contents of a text file in JTextArea warship New To Java 17 07-13-2009 06:44 AM
[SOLVED] Line number: ? Azndaddy New To Java 1 04-04-2008 06:46 AM
[SOLVED] Delete Current line from file Azndaddy New To Java 1 03-28-2008 01:37 PM
Display Line# and Column# in JSP loganathan.lakshmanan JavaServer Pages (JSP) and JSTL 3 01-17-2008 01:37 PM
How to always show the last line in my JTextArea? Ashley New To Java 1 05-26-2007 02:01 PM


All times are GMT +2. The time now is 01:47 AM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org