This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
From the following startup applet, I instantiate the above applet
The startupUpApplet invokes another applet, which evtly flushes the data to the TXDetailData as well as update the index for the next lot of data (in other words, it keeps multiple records):
ANd finally I added a little CleanUp routine which displays the updated TXDetailData to test the whole thing
When I tested it this morning without index it worked fine. After I've added the index, and recompiled Java console reports the runtime error "NullPointerException". Can anyone help out please? TIA :-) [ February 24, 2004: Message edited by: Jim Yingst ]
Nowhere in this code do you initialize the two array variables var_acctName and var_unitCost; they're both null. Hence, when you try to use them, you'll get a NullPointerException. You need to actually create an array object using "new" -- i.e., String var_acctName = new String; I used "100" as the size because it wasn't clear to me what you'd want to size to be. If you don't know either, you should consider using ArrayLists instead of arrays, since ArrayLists can grow as needed.
Arrgh, you hit the nail on the head. Let's say a client buys pizza, pasta, salat, what ever over the Net, where each dish has its own JFrame, and I've to save the client's selection to a singleton pending flushing to the database on commit, then there is no way for me to know how big the order will be, hence I wouldn't know how big the array or hashtable should be. That's my dilemma. Having said that, I agree array is probably on the extravagant side. Thanks for taking time to look at my issue :-)