Question

I would like to insert some code manually inside the generated code in java swing how to go ahead with that ? please help me out with your answer guyz

Était-ce utile?

La solution

If you are using GUI Builder, the code inside of the method initComponents() should not be messed with. It only deals with initializing the components and laying out the components. If you try messing with the layout, you might break the whole thing. Since everything is initialized in the initComponents, just add you code below it.

public class FrameForm extends JFrame {
    public FrameForm() {
        initComponents();
        Your Code Here!
    }
}

If you really need to add code inside the initComponents though, just right click on a component form the design view and select Customize Code from the context menu.

Autres conseils

You could go to your project directory and go inside to your package.inside the src folder you could find the java class.Right click on that file and open it using a text editor which will enable you to edit anything but use it carefully because one mistake could effect your whole project

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top