The Source for Java Technology Collaboration

Home » java.net Forums » Mobile & Embedded » LWUIT

Thread: how to control the square size of a checkbox?

Welcome, Guest Help
Login Login
Guest Settings Guest Settings
Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 4 - Last Post: Jun 29, 2009 12:05 AM by: anson ho
anson ho
how to control the square size of a checkbox?
Posted: Jun 19, 2009 6:52 AM
  Click to reply to this thread Reply

I got a BIG bitmap font a the west of a borderLayout, a medium size
system font label in the center. and a small size system font checkbox in
east. The square of the checkbox becomes big and looks weird.

Then, I found that the square size of a checkbox is determined by the
layout height. But I want to control it so that the size will be according
to the checkbox's font height. I have tried to override the
calcPreferredSize() of the checkbox but it turns out that the size is
determined by the height of the checkbox's layout manager. So, what should I
do?
[att1.html]


Shai Almog
Re: how to control the square size of a checkbox?
Posted: Jun 20, 2009 9:58 PM   in response to: anson ho
  Click to reply to this thread Reply

Its determined by the font size.
You can override checkbox painting but that would be like reimplementing
the checkbox, or you can use DefaultLookAndFeel.setCheckBoxImages
>
> I got a BIG bitmap font a the west of a borderLayout, a medium size
> system font label in the center. and a small size system font checkbox
> in east. The square of the checkbox becomes big and looks weird.
>
> Then, I found that the square size of a checkbox is determined by
> the layout height. But I want to control it so that the size will be
> according to the checkbox's font height. I have tried to override the
> calcPreferredSize() of the checkbox but it turns out that the size is
> determined by the height of the checkbox's layout manager. So, what
> should I do?
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net


anson ho
Re: how to control the square size of a checkbox?
Posted: Jun 26, 2009 6:07 AM   in response to: Shai Almog
  Click to reply to this thread Reply

I don't understand. If the square size is determined by checkbox font size.
Why does the following happen?
Case 1, the checkbox font size is LARGER than the bitmap font size, the
checkbox displays ok. please see fig_1.jpg

Case 2, the checkbox font size is SMALLER than the bitmap font size, the
checkbox is currupted. please see fig_2.jpg.

Please advise. I really need to find a solution to this problem.


On Sun, Jun 21, 2009 at 12:58 PM, Shai Almog <Shai.Almog@sun.com> wrote:

> Its determined by the font size.
> You can override checkbox painting but that would be like reimplementing
> the checkbox, or you can use DefaultLookAndFeel.setCheckBoxImages
>
>>
>> I got a BIG bitmap font a the west of a borderLayout, a medium size
>> system font label in the center. and a small size system font checkbox in
>> east. The square of the checkbox becomes big and looks weird.
>>
>> Then, I found that the square size of a checkbox is determined by the
>> layout height. But I want to control it so that the size will be according
>> to the checkbox's font height. I have tried to override the
>> calcPreferredSize() of the checkbox but it turns out that the size is
>> determined by the height of the checkbox's layout manager. So, what should I
>> do?
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>
[att1.html]
[fig_1.JPG]
[fig_2.JPG]
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net


Shai Almog
Re: how to control the square size of a checkbox?
Posted: Jun 27, 2009 10:44 PM   in response to: anson ho
  Click to reply to this thread Reply

The sizes seem correct but the drawing seems to have an issue with
available size.
If you can produce compilable code to reproduce this please file an issue.
> I don't understand. If the square size is determined by checkbox font
> size. Why does the following happen?
>
> Case 1, the checkbox font size is LARGER than the bitmap font size,
> the checkbox displays ok. please see fig_1.jpg
>
> Case 2, the checkbox font size is SMALLER than the bitmap font size,
> the checkbox is currupted. please see fig_2.jpg.
>
> Please advise. I really need to find a solution to this problem.
>
>
> On Sun, Jun 21, 2009 at 12:58 PM, Shai Almog <Shai.Almog@sun.com
> <mailto:Shai.Almog@sun.com>> wrote:
>
> Its determined by the font size.
> You can override checkbox painting but that would be like
> reimplementing the checkbox, or you can use
> DefaultLookAndFeel.setCheckBoxImages
>
>
> I got a BIG bitmap font a the west of a borderLayout, a
> medium size system font label in the center. and a small size
> system font checkbox in east. The square of the checkbox
> becomes big and looks weird.
>
> Then, I found that the square size of a checkbox is
> determined by the layout height. But I want to control it so
> that the size will be according to the checkbox's font height.
> I have tried to override the calcPreferredSize() of the
> checkbox but it turns out that the size is determined by the
> height of the checkbox's layout manager. So, what should I do?
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> <mailto:users-unsubscribe@lwuit.dev.java.net>
> For additional commands, e-mail: users-help@lwuit.dev.java.net
> <mailto:users-help@lwuit.dev.java.net>
>
>
>
> ------------------------------------------------------------------------
>
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>

[att1.html]
[att1.dat]
[att1.dat]


anson ho
Re: how to control the square size of a checkbox?
Posted: Jun 29, 2009 12:05 AM   in response to: Shai Almog
  Click to reply to this thread Reply

I have produced a code snippet and it seems that the square size is
according to the layout size.
Form f = new Form();
f.setLayout(new BorderLayout());
f.addComponent( BorderLayout.CENTER,new com.sun.lwuit.CheckBox("test"));
f.show();

The above code generates the attached output. As you can see, the square
size is really big and the word "test" is not visible.



On Sun, Jun 28, 2009 at 1:44 PM, Shai Almog <Shai.Almog@sun.com> wrote:

> The sizes seem correct but the drawing seems to have an issue with
> available size.
> If you can produce compilable code to reproduce this please file an issue.
>
> I don't understand. If the square size is determined by checkbox font size.
> Why does the following happen?
> Case 1, the checkbox font size is LARGER than the bitmap font size, the
> checkbox displays ok. please see fig_1.jpg
>
> Case 2, the checkbox font size is SMALLER than the bitmap font size, the
> checkbox is currupted. please see fig_2.jpg.
>
> Please advise. I really need to find a solution to this problem.
>
>
> On Sun, Jun 21, 2009 at 12:58 PM, Shai Almog <Shai.Almog@sun.com> wrote:
>
>> Its determined by the font size.
>> You can override checkbox painting but that would be like reimplementing
>> the checkbox, or you can use DefaultLookAndFeel.setCheckBoxImages
>>
>>>
>>> I got a BIG bitmap font a the west of a borderLayout, a medium size
>>> system font label in the center. and a small size system font checkbox in
>>> east. The square of the checkbox becomes big and looks weird.
>>>
>>> Then, I found that the square size of a checkbox is determined by the
>>> layout height. But I want to control it so that the size will be according
>>> to the checkbox's font height. I have tried to override the
>>> calcPreferredSize() of the checkbox but it turns out that the size is
>>> determined by the height of the checkbox's layout manager. So, what should I
>>> do?
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
>> For additional commands, e-mail: users-help@lwuit.dev.java.net
>>
>>
>
> ------------------------------
>
>
> ------------------------------
>
> ------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>
>
[att1.html]
[fig1.JPG]
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
For additional commands, e-mail: users-help@lwuit.dev.java.net





 XML java.net RSS