Does not work GridBagConstraints.NORTH in Configurable
Answered
Does not work GridBagConstraints.NORTH in Configurable. Panel elements are always centered vertically
@Override
public @Nullable JComponent createComponent() {
rootPanel = new JPanel(new GridBagLayout());
Color color = new Color(55, 85, 134);
rootPanel.setBackground(color);
GridBagConstraints gc = new GridBagConstraints();
gc.anchor = GridBagConstraints.NORTH;
gc.fill = GridBagConstraints.HORIZONTAL;
gc.gridx = 0;
rootPanel.add(new JTextField(), gc);
rootPanel.add(new JTextField(),gc);
return rootPanel;
}
Please sign in to leave a comment.
Solution