Yello,
What should have been a simple process...
I created a class which extends JTextField.
In the constructor, I want this class to have a line border with whatever color and a left inset of 10.
However, setting a custom border ignores the setMargin(). If I remove the border line, the margin shows up fine.
Is there a way to accomplish both?
This is what I thought should work:
...
LineBorder border = new LineBorder(new Color(100, 100, 100), 1);
this.setBorder(border);
this.setMargin(new Insets(0, 10, 0, 0);
...
I tried the following, but it doesn't seem to work either:
LineBorder border = new LineBorder(new Color(100, 100, 100), 1);
Insets insets = border.getBorderInsets(this, new Insets(0, 10, 0, 0));
this.setMargin(insets);
What am I doing wrong? =)