Forums Register Login
Swing GUI Design ideas
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.


This thread has been viewed 565 times.

All times above are in ranch (not your local) time.
The current ranch time is
Oct 15, 2018 17:15:12.