Search code examples
javaswinglayout-managergridbaglayout

GridBagLayout location should be in another place?


I have the following code

GridBagConstraints c = new GridBagConstraints();
    c.gridx=0;
    c.gridy=0;
    c.gridwidth=1;
    c.gridheight=1;
    c.fill = GridBagConstraints.BOTH;
    c.insets= new Insets(2,2,2,2);
    this.add(pdfUrl,c);
    c.gridx=1;
    c.weightx=0.1;
    c.gridwidth=4;
    this.add(pdfUrlin,c);
    c.gridx=0;
    c.gridwidth=1;
    c.gridy=1;
    c.weightx=0.0;
    this.add(pdfType);

This code produce this The code produces this

I do not understand why the PDF Type is not on the line below. Can anyone help me out here?

Thanks in advance


Solution

  • Small error, I think you meant to do: this.add(pdfType, c); instead of this.add(pdfType); =)