use of javax.swing.border.AbstractBorder in project java-swing-tips by aterai.
the class TitledBorderUtil method getBorderInsets.
// private static Insets getBorderInsets(Border bdr, Component c, Insets insets) {
public static Insets getBorderInsets(Border bdr, Component c) {
Insets insets = new Insets(0, 0, 0, 0);
if (bdr instanceof AbstractBorder) {
AbstractBorder ab = (AbstractBorder) bdr;
insets = ab.getBorderInsets(c, insets);
} else if (Objects.nonNull(bdr)) {
Insets i = bdr.getBorderInsets(c);
insets.set(i.top, i.left, i.bottom, i.right);
}
return insets;
}
Aggregations