File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Proper design question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Proper design question" Watch "Proper design question" New topic

Proper design question

Greg Belyea

Joined: Feb 06, 2004
Posts: 29
Hey Guys

I am trying to solve a problem and have been out of the game for a bit... question... i have created a GUI Panel that has drag and drop capability, i drag an id from the left list box and drop in the right if i want to disable something for that id.. if i drag it back out of the right to left then that id is enabled again... that all works great, my problem is i would like to leave that as a dumb panel that i just pass a couple vectors to and it does it's thing... problem is I need it to add and remove records from a database table though when items are successfully added and removed to/from the right hand list..

I don't wanna stick that logic in the simple GUI panel that could be reused if i don't, how should i design this properly so that any business specific logic is not tainting my new control.. I almost went quick and dirty to get it done, but i don't really want to do that... If it's not reasonably simple i could just stick a couple buttons there for save and cancel and they could grab the current list models, but i'd almost like it to be instant with no more steps..

pete stein

Joined: Feb 23, 2007
Posts: 1561
Perhaps you could give the Gui a public method addListDataListener(ListDataListener ldl) that would allow an outside class to listen to the JList's data model.
I agree. Here's the link:
subject: Proper design question
It's not a secret anymore!