• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JTable editing

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Kate Zoy
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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!
 
"The Hood"
Posts: 8521
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
The moth suit and wings road is much more exciting than taxes. Or this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic