imported_Ned Flanders
Senior member
Hey,
I'm pretty good at coding in Java, and I know how to create GUI's using the standard Swing/AWT classes - But with a new program I'm coding some elements need pretty big methods to create them.
At the moment for a program I am producing I have a Client class with
1300+ lines of code in it. I also have a 'dialog' package with 6 different diaogs in it.
I have created the dialog classes because they are distinctly separate elements to the GUI, but now I am questioning whether other elements could be 'classified' - i.e
My menu bar can either be the classic JMenuBar or a better looking JTabbedPane/JPanel combo - The code for the actionListeners and menu construction is about 650 lines.
I have a list bar (shows a list of items which are selectable) - The method takes a Vector of strings and creates a list of JLabels witha generic mouseAdapter used to toggle bold as the mouse passes over it. When clicked, another method is called to build and show a JPopupMenu.
At the moment, I am having problems managing the 1300+ lines of code in one class. Version 2 of my program is needed!
I guess my question is:
When does the amount of code (or needed functionality?) in a method to produce a particular element of my GUI justify it to be put into its own class?
Many thanks.
I'm pretty good at coding in Java, and I know how to create GUI's using the standard Swing/AWT classes - But with a new program I'm coding some elements need pretty big methods to create them.
At the moment for a program I am producing I have a Client class with
1300+ lines of code in it. I also have a 'dialog' package with 6 different diaogs in it.
I have created the dialog classes because they are distinctly separate elements to the GUI, but now I am questioning whether other elements could be 'classified' - i.e
My menu bar can either be the classic JMenuBar or a better looking JTabbedPane/JPanel combo - The code for the actionListeners and menu construction is about 650 lines.
I have a list bar (shows a list of items which are selectable) - The method takes a Vector of strings and creates a list of JLabels witha generic mouseAdapter used to toggle bold as the mouse passes over it. When clicked, another method is called to build and show a JPopupMenu.
At the moment, I am having problems managing the 1300+ lines of code in one class. Version 2 of my program is needed!
I guess my question is:
When does the amount of code (or needed functionality?) in a method to produce a particular element of my GUI justify it to be put into its own class?
Many thanks.