Not sure if I'm just using a visual basic approach, but I was under the impression i could use the window builder in eclipse to create my Jframes, then simply invoke them when the button/actionlistener is selected...
Like:
JButton btn_register = new JButton("Register");
btn_register.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
frm_register.setvisible(true);
}
frm_register is the class name for the register form...
YourFrame frame=new YourFrame();
frame.setVisible(true);
frm_register is the class name for the register form...
I hope not. Class names should start with upper case character. For example: RegistrationForm.
Then you need code like:
RegistrationForm register = new RegistrationForm();
register.setVisible( true );
This of course assumes that the constructor for the RegistrationForm adds components to the form and does a pack on the form.
i could use the window builder in eclipse to create my Jframes,
Also, you should not be using a JFrame. An application generally has a single JFrame. A child window would typically be a JDialog. See: The Use of Multiple JFrames: Good or Bad Practice?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.