Forums Register Login

Swing GUI Design ideas

+Pie Number of slices to send: Send
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.

Regards
Ravi
An elephant? An actual elephant. Into the apartment. How is the floor still here. Hold this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 697 times.
Similar Threads
Yes! Passed! 388/400
Interview Q for testing
Still having some trouble with Observer/Observable
Set up Jlist
GUI :(
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 00:56:12.