I have created a JFrame form using netbeans GUI builder and place buttons on it and everything is functioning well.Now what i want is to call another JFrame when i press a button.This i have also written a code and its working but the problem is that i want to design this JFrame the same way i designed it my main JFrame where as the GUI builder shows me the first JFrame only.Please guide me what to do in this scenerio.
JFrame v = new JFrame("Password");
v.setVisible(true);
v.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
v.setSize(100, 100);
I will assume your using netbeans so sorry if I’m wrong about that (you didn’t say).
There are two way to do this the first is to create a separate form for your new JFrame (Right-click>New>JFrame) and then create a new instance of it when your button is clicked.
The second option is to add it in GUI builder if you do this it won’t show at first, you have to go to the left hand side where there is a list of components and click on Other Components>jframe1 to make it appear (this will hide your main form which you can hide by clicking on the main form component in the navigator.