I have created 2 JTables with my own custom TableModel which extends AbstractTableModel. I am wondering how to make every cell in my table be editable. As of right now, I have created MyTableModelListener which implements TableModel Listener. My problem is that when I run my GUI program, I can change one cell once (at which points it changes the same cell in the second table) and then gives me a java.lang.StackOverFlowError every time I try to click onto a different cell. What's going on, and how can I get my tables to work independently of one another? Moreover, why is it giving me a Stack overflow?! I've been playing with the code for days and no matter what I do, it always works all crooked!
Hey, i would say you have 1 of two posible problems. StackOverFlow occurs when you get cought in a loop. i guessing you may be firing the same event over and over. also the problem with one table updating another sounds like each table has the others model. 1. check the tables model is correct. 2. debug your code and find exactly where the code gets cought in a loop (System.out.println()) Hopefully this helps.
Joined: Feb 11, 2004
I think I was trying to hard, making it more complicated then it needed to be. I got rid of most of my "custom" classes and let JTable do its thing... It seems to be going smoother now. It was, in fact, stuck in a loop. As to the 2 tables, I figured that both tables could use the same constructing class, which is true. What I did wrong, I just realized, is that both tables were using the same instance of that class. Oops! Thanks alot for your help!
zoy, Welcome to JavaRanch!! Please change your name to be compliant with JavaRanch's naming policy. It should not be obviously fictitious. Your displayed name should be 2 separate names with more than 1 letter each. We really would prefer that you use your REAL name. You can change your name: here. Thanks, Cindy
"JavaRanch, where the deer and the Certified play" - David O'Meara