How to refactor Netbeans generated GUI code?

10.000 lines of code sounds like you have everything in that single class.

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.

1 Note: it's important to set the new JPanel's layout manager to match the original panel or the result of the paste won't look anything like the original. – Devon_C_Miller Feb 18 '10 at 19:57.

Well - if the code is generated, I don't see any advantages in refactoring it as long as the tool which generated it can handle it. The tool (meaning the designer in this case) will "destroy" all your refactoring work as soon as it updates the code. However, you should split your Control/Window/... into multiple controls - then the code will automatically get shorter and you will be able to maintain your UI more easily.As a conclusion: Do not refactor the generated code but do refactor your control.

Netbeans refused to handle it by displaying a compiler error - Code too large.... – Yatendra Goel Jan 23 '10 at 10:31 The GUI is desined through Panels... There are lots of Panel in the gui.... How can I write a separate class for each Panel and call it from the main JFrame – Yatendra Goel Jan 23 '10 at 10:32 As said by Peter Lang: Use JPanels for groups of controls and drag them onto your "Mainframe". – winSharp93 Jan 23 '10 at 12:16.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions