wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes My program forgets about previously stored elements Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "My program forgets about previously stored elements" Watch "My program forgets about previously stored elements" New topic
Author

My program forgets about previously stored elements

abdy hussein
Greenhorn

Joined: Feb 16, 2012
Posts: 10
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

Joined: Dec 08, 2010
Posts: 1502
    
    5

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!


Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
abdy hussein
Greenhorn

Joined: Feb 16, 2012
Posts: 10
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

Joined: Oct 13, 2005
Posts: 38033
    
  22
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: My program forgets about previously stored elements
 
Similar Threads
Right click popup menu
Insert an image in JScrollPane
error regarding jdic
Pass data back to Window 1 from Window 2
java unable to delete from array list