Skip to content

GridBagConstraints are not parsed #1539

Description

@WolfgangHG

I have this code snippet (originally old code, created without a GUI designer) where the GridBagConstraints are not properly parsed by WindowBuilder:

public MainFrame3()
{
  ...
  
  contentPane = new JPanel();
  contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
  setContentPane(contentPane);
  
  GridBagLayout layout = new GridBagLayout();
  contentPane.setLayout(layout);
  
  ...
  
  JButton btnNewButton = new JButton("New button");
  layout.setConstraints(btnNewButton, new GridBagConstraints(1, 0, 1, 1, 1.0, 0, GridBagConstraints.WEST,
      GridBagConstraints.HORIZONTAL, new Insets(10, 0, 0, 10), 0, 0));
  contentPane.add(btnNewButton);
}

The GridBagConstraints properties don't show the correct ANCHOR, FILL and WEIGTHX values and the button is not rendered properly in preview:

Image

Attached is a full sample project - open "MainFrame3.java" in designer:

WindowBuilderSample.zip

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions