This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

saving data to database without pressing button

 
elwin Ilam
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

I've got a jTable which shows data from my sqlite database. There are 12 checkboxes above the jtable, which each represent a different set of data.
currently, if you select a checkbox and press load, the right set of data is loaded. if you press save the data is stored again in the database.

Now, would it be possible...to do the saving and loading without pressing the save and load buttons? If you just click on a checkbox the right set of data is loaded....and somehow saved if you change it.

my ideas so far:
- use an entry row. so all the data is stored if you enter an additional row, then the loading can be done with checking the checkboxes. However not really aesthetically pleasing.
- if a checkbox is selected, save the current data first, then load the new data. But there are loopholes here, when data does not get saved.

Could you give me some advice?
Thanks alot
Elwin

here is the code I'm currently using to save and load (from the GUI Panel).

Saving:


Loading:
 
elwin Ilam
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I figured something out.

Data is saved when table loses focus,
Data is loaded when checkboxes are statechanged.

It seems to work pretty good.
Only when the Cell editor is still on, things go wrong.
But we'll see about that after the weekend (:
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic