Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

JTable: updating cells programitcally

Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
2 of the columns in my JTable hold monetary values ( double).
If the value in cell A changes, then value B should be updated with the result of a calculation performed using the new value in A and the old value in B.
Sort of like a spreadsheet.
I can't seem to set the new value of A for use in a simple calculation.

At present my code is as follows:
[edited to remove those evil tab characters -ds ]
[ October 18, 2002: Message edited by: Dirk Schreckmann ]
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I haven't tried your code, but I think there are more conventional ways to solve your problem that are [BOLD]much[/BOLD] simpler.
something like this:

Basic idea:
1. there is some data that are stored in your cache object
2. there is a GUI object (e.g. JTable) that is the interface, but does not store the data
3. you use a model (e.g. TableModel) to control the data and interface between the data cache and the view
I'm sure other people could list numerous resources on this Design Pattern.
    Bookmark Topic Watch Topic
  • New Topic