Reputation: 351
How to prevent shrinking JPanel which contains only JFormattedTextFields.
JFormattedTextField textF1;
JFormattedTextField textF2;
textF1 = new JFormattedTextField(numberFormat);
textF2 = new JFormattedTextField(numberFormat);
JPanel labelPane = new JPanel(new GridLayout(0,1));
labelPane.add(textF1)
labelPane.add(textF2)
setBorder(BorderFactory.createEmptyBorder(50, 50, 50, 50));
add(labelPane, BorderLayout.LINE_START);
add(fieldPane, BorderLayout.CENTER);
add(imagePane, BorderLayout.LINE_END);
problem is with fieldPane. It always shrinks. I have tried to set textfield to minimum size, set manually dimensions. Even set prefferd size, setMaximumSize. Not of this works.LabelPane and imagePane work fine.
Upvotes: 0
Views: 31