I had created a GUI in Netbeans through Netbeans Swing GUI creator. So I just dragged and dropped the Swing Components from the "palette" window and all the code was generated by netbeans.
Now the code is too long to maintain (approx. 10,000 lines). So some experts on SO suggested me to refactor my code.
I can refactor the code that was generated by me but I don't know how to refactor the code generated by the Netbeans as It doesn't allow editing in its generated code.
Any suggestions?
10.000 lines of code sounds like you have everything in that single class.
Start by splitting your source into Model, View and Control (MVC).
You might also be able to extract some JPanels
into separate classes. One way to do this is to create a new JPanel
(new file), and cut/paste your compoments from one main panel into that new JPanel
. Save and compile your new panel.
Then go back to your main frame, select Beans
-> Choose Bean
from your Palette
and choose the newly created class (com.example.YourPanel
for example).
Make sure to have a backup of your application before you try this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With