I don't understand how you expect this to work?
You have a button with long text that breaks lines. How do you expect this 
to be centered?
If you explicitly line break with \n then there will be room for centering.

Alternatively just use a bit of margin on the side to limit the space 
available for the buttons and form the effect of centering.

On Tuesday, June 8, 2021 at 10:53:29 AM UTC+3 [email protected] wrote:

>
> https://www.codenameone.com/javadoc/com/codename1/ui/layouts/FlowLayout.html
>
> use the constructor with the orientation param and use CENTER
>
> On Tue, 8 Jun 2021 at 07:26, 'P5music' via CodenameOne Discussions <
> [email protected]> wrote:
>
>> Thanks
>> I already tried with FlowLayout and the size is correct, but the button 
>> is on the left.
>> So I added the FlowLayout container to a BorderLayout in the CENTER 
>> position, but the button still is on the left.
>> Regards
>> Il giorno martedì 8 giugno 2021 alle 00:00:58 UTC+2 [email protected] 
>> ha scritto:
>>
>>> Option 1. Add them to a flowlayout container and add that container to 
>>> the boxlayout.y
>>> Option 2. Override calcPreferredSize and set them to a custom width
>>>
>>> There are more ways
>>>
>>> On Mon, 7 Jun 2021, 21:12 'P5music' via CodenameOne Discussions, <
>>> [email protected]> wrote:
>>>
>>>> There are only two Buttons with a round border over my CN1 app.
>>>>
>>>> I have an issue with the two buttons. I did not realize it before 
>>>> because they had no border and no bg.
>>>>
>>>> I put them in a BoxLayout.y() container along with other components.
>>>> They are in different places of the vertical container but it does not 
>>>> matter.
>>>>
>>>> They are horizontally centered, while one would expect they are on the 
>>>> left.
>>>> But this is good for me because I want those buttons to be centered.
>>>>
>>>> The issue is that they are huge, the text is centered but the buttons 
>>>> span the entire screen width.
>>>>
>>>> I just want them to be centered buttons that wrap their text.
>>>> I also tried enclosing each of them in a BorderLayout container but its 
>>>> the same.
>>>>
>>>> Maybe I forgot some silly thing, but I do not know.
>>>>
>>>> Thanks in advance
>>>>
>>>> -- 
>>>> 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/de82d9d6-a2fe-4ebd-89a5-08f99c5f11c3n%40googlegroups.com
>>>>  
>>>> <https://groups.google.com/d/msgid/codenameone-discussions/de82d9d6-a2fe-4ebd-89a5-08f99c5f11c3n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>>> .
>>>>
>>> -- 
>> 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/eec24794-bd12-4d29-8c09-507e4e7065ean%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/codenameone-discussions/eec24794-bd12-4d29-8c09-507e4e7065ean%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 
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/158ee73c-e824-4ffb-b993-3ac103602b4bn%40googlegroups.com.

Reply via email to