Home arrow static arrow Java Programming [Archive] - associate swing objects with data class
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - associate swing objects with data class
This topic has 1 reply on 1 page.

Posts:8
Registered: 6/16/04
associate swing objects with data class  
Jun 16, 2004 5:45 AM



 
Hello all: It's been 4 years since any major programming, so be gentle.

I am trying to develop a very simple form application. It is an application that Doctors can use to automatically generate prescriptions and instructions for patients.

The app is basically a form with many lines, one for each drug. On each line are 2 groups of radio buttons, one for which eye to place the drops and the other for how many times per day. In total there are 2 check boxes and 6 radio buttons per line of which only two many be selected (you can't take the drup 2 and 3 times a day).

I want to create a new class called "drug" which will hold the settings as they are selected on the screen. FOr example, if Drug x is selected for the right eye 4 times a day, the drug x object should hold this data.

Rather than hard coding each button to a specific drug (if drug y, button 5 selected, set drugy.dose=3), just have the button within the class so I can just query the drug (if drugy.button5==1).

I plan on storing these drug objects in a vector and simply run through the array looking for selected drugs.

All help greatly appreciated, Chris.
 

Posts:6,750
Registered: 1/25/04
Re: associate swing objects with data class  
Jun 16, 2004 9:17 AM (reply 1 of 1)



 
First comment, I think Drug is not a good name for that class. Perhaps Prescription would be better. Second comment, separate logic from presentation - ie it's a bad idea to put swing components in your domain class. You should be able to use that Prescription plug in a variety of situations - swing, command-line, server-side batch processing, whatever. Third comment, if I were designing such an interface I would consider making the doses per day a combo box rather than radio buttons.
 
This topic has 1 reply on 1 page.