Hi, I am building a swing GUI. I am trying to find the best approach to meet the following requirements.
The GUI has a function dropdown at the top. There are about 15 functions. When a function is selected. A panel will be shown for dataentry which has about 20 fields. For each of the 15 functions, most of these 20 fields are needed for data entry. Some of them are not needed. So based on the function selected, I have to either hide the unwanted fields or disable them.
There are 2 options :
1. Create 15 separate panels, one for each function. This will keep the code clean (without any if then else.. etc). But will duplicate a lot of code.
2. Have only one panel that caters to all 15 functions. But involves a lot of if then else. Also, I have to consider the tab-order so that focus jumps the disabled fields, etc..
Is there any clean solution for this kind of requirement. Any design pattern etc I can look at.
Too many men are afraid of being fools - Henry Ford. Foolish tiny ad:
Thread Boost - a very different sort of advertising