JButton and non-default Border
Hi,
I am trying to use non-default border for a JButton.To be specific i am using BevelBorder for bordering my button.
JButton saveButton = new JButton("Save");
saveButton.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
I want to have a margin between the text on the button and the border. For this there is a method called setMargin(Insets ins) , but it is not doing the required task. As a result i get a very small sized button with hardly any space between the border and button's text. Documentation for this method explains the reason for its failure to perform expected results but I don't know how to get it working. It would be great if someone could help me out with this. For convenience i am also copying the documentation of that method.
And one more thing , if i continue to use this method with the default border for the button it works.
Doc:
public void setMargin(Insets m)
Sets space for margin between the button's border and the label. Setting to null will cause the button to use the default margin. The button's default Border object will use this value to create the proper margin. However, if a non-default border is set on the button, it is that Border object's responsibility to create the appropriate margin space (else this property will effectively be ignored).
Thanks
Inderjit

