The code is like this:
JTextField txt = new JTextField();
txt.setBorder(BorderFactory.createMatteBorder(2,2,2,2,Color.red));
However the text field is ignoring my call to setBorder
.
No changes whatsoever.
I were to replace it with a JLabel
(for instance)
JLabel txt = new JLabel();
txt.setBorder(BorderFactory.createMatteBorder(2,2,2,2,Color.red));
I would see the red border.
Can anybody tell me why? Or even better explain to me how to add a border in the JTextField
?