Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

My program forgets about previously stored elements

 
abdy hussein
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I was working on a simple GUI program to send short messages to a remote device.. The title of the messages are saved on a list after the messages are sent such that the user can select to view previously sent messages.
I have got the first part working perfectly but my program doesn't remember anything after each run. The list will be empty after running the program each time. Here is my code. I used Netbeans IDE to design the interface but I did the event handling part. Adding items to the list starts from line no. 96.

 
Anayonkar Shivalkar
Bartender
Posts: 1557
5
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
abdy hussein wrote:Adding items to the list starts from line no. 96.

Well, I did not see any code which adds something to list. Can you please be more descriptive about what you are trying to do (e.g. it seems that you are doing some file operations)?

And welcome to CodeRanch!
 
abdy hussein
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I do add elements to the list at line 121.

Sorry to have posted the whole code. The file operations are meant for something else that have no effect on the above problem.

Thanks.
 
Campbell Ritchie
Sheriff
Posts: 48363
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is too much code for us to go through. In line 121, you appear to add something to listModel. Where do you store that for future runs? What does the new List using listModel as a constructor parameter do? Is it created before or after you add to listModel?
You are going to have to do some debugging, using the NetBeans debugger, or adding print instructions, to see what you have in the list model and the list as you execute your application.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic