Hi, sorry for the very basic question but I feel I have a hole in my abc's. I want to make a plain old dialog that has to change the color of an item, actually many different items that are stored in many different JTables in a dialog.
What is the best way to interact with the db?
Do I create DBHandler class and pass and instance of that directly to the Dialog? Or do I make just a HandlerClass that I pass the DBHandler class into, then pass that regular HandlerClass into the Dialog for other purposes also?
And how do I pass the info, should I pass the TableModel or is that too specific?
So what I kindof see is something like this:
//the constructor would take the handler
Dlg(Handler handler)
//then to populate the dlg I could call a bunch of functions
handler.getSoAndSo();
handler.getAnotherSoAndSo(); //which would delegate this to the DBHandler and get the info from the db?
Dlg.save(tblModel)
or actually I have a few table models to save so I should
Dlg.save(map) //map of table models
and then the Handler class would just delegate it to the DBHandler. This seems like adding a middle man for no reason.
I know this seems so basic but I don't even know how to do this.
Spend like you don't need the money,
love like you've never been hurt and dance like nobody's watching!
What is the best way to interact with the db?
Do I create DBHandler class and pass and instance of that directly to the Dialog? Or do I make just a HandlerClass that I pass the DBHandler class into, then pass that regular HandlerClass into the Dialog for other purposes also?
And how do I pass the info, should I pass the TableModel or is that too specific?
So what I kindof see is something like this:
//the constructor would take the handler
Dlg(Handler handler)
//then to populate the dlg I could call a bunch of functions
handler.getSoAndSo();
handler.getAnotherSoAndSo(); //which would delegate this to the DBHandler and get the info from the db?
Dlg.save(tblModel)
or actually I have a few table models to save so I should
Dlg.save(map) //map of table models
and then the Handler class would just delegate it to the DBHandler. This seems like adding a middle man for no reason.
I know this seems so basic but I don't even know how to do this.
Spend like you don't need the money,
love like you've never been hurt and dance like nobody's watching!