RoundRectBorder has some intrinsic minimum size specifically calculated 
like this:
@Override
public int getMinimumHeight() {
     return Display.getInstance().convertToPixels(shadowSpread) + Display.
getInstance().convertToPixels(cornerRadius) * 2;
}

@Override
public int getMinimumWidth() {
    return Display.getInstance().convertToPixels(shadowSpread) + Display.
getInstance().convertToPixels(cornerRadius) * 2;
}

If you reduce the size of the shadowSpread to 0 it should reduce some of 
that additional padding.

On Thursday, April 22, 2021 at 6:54:08 PM UTC+3 [email protected] wrote:

> In creating a button I find I can only reduce the padding to a certain 
> point. The code I'm using is:
>
> Button btnname = new Button(itm.name);
> Style nameStyle = btnname.getAllStyles();
> RoundRectBorder roundBorder = RoundRectBorder.create().cornerRadius((float) 
> 2);
> nameStyle.setBorder(roundBorder);
> nameStyle.setFgColor(0xffffff);
> nameStyle.setBgColor(0);
> nameStyle.setBgTransparency(64);
> nameStyle.setPaddingUnit(UNIT_TYPE_PIXELS);
> nameStyle.setPadding(Component.BOTTOM,20);
> nameStyle.setPadding(Component.TOP,20);
>
> The padding I'm observing is the distance between the edge of the text and 
> the edge of the border. If try to set the padding below 20 there is no 
> change.
>
> -Dennis
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/codenameone-discussions/dcb16adf-b672-4c80-8f2d-ec20fffae694n%40googlegroups.com.

Reply via email to