by blombar » Sat Oct 09, 2010 7:20 am
I am looking for some infomation on strategies for producing clean and well structured code for a swing GUI application. I notice that by default Swing Designer generates inline code for each component. There are some preference option to generate lazy instantiation of components, or to generate blocks, but all the code still goes into one big long method. I would think that cleaner, more understandable and more maintainable code would come from generating methods to instantiate components. For example, I would like to define a titlePanel, logoPanel, helpPanel, buttonPanel and several dataPanels and put them together into a JFrame. I would envision a high-level method that would have only about one line for each panel. Then the structure of the application would be apparent and the panels reusable. Is there a way that I can acheive this without hand restructuring the code? I see that custom components can be defined is that the way to do it?