Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Swing GUI Design ideas  RSS feed

 
Ravi Kumaar
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!