0

this is the result i am trying to:

http://beepleased.com/wordpress/wp-content/uploads/2013/11/2.jpg

and this is my code:

    panelSignUp.add(new JLabel("Name:"));
//      this.getContentPane().add(nameTextField,)
        panelSignUp.add(nameTextField);

     panelSignUp.add(new JLabel("Email:"));
//      this.getContentPane().add(nameTextField,)
        panelSignUp.add(emailTextField);

     panelSignUp.add(new JLabel("Username:"));
//      this.getContentPane().add(nameTextField,)
        panelSignUp.add(userNameTextField);

     panelSignUp.add(new JLabel("Password:"));
//      this.getContentPane().add(nameTextField,)
        panelSignUp.add(passwordTextField);

        panelSignUp.add(signDone);





this.setLayout(new GridLayout(5,2));
        this.setContentPane(panelSignUp);
        this.setSize(400, 300);
        this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        this.setVisible(true);

all go well, the only problem is that the elements are presenting in an order different from GridLayout....Q-/

Whats should i do?

2
Contributors
1
Reply
7
Views
3 Years
Discussion Span
Last Post by mKorbel
0
  • JPanel uses FlowLayout as default LayoutManager inplemented in API

  • set GridLayout to JPanel (you already set to JFrame, then there you put JPanel with JComponents)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.