Skip to main content

Overlapping components

3 replies [Last post]
shai126
Offline
Joined: 2008-07-06

Hi

I want to place a component overlapping on top of another component; that is, have the two components next to each other in an X-AXIS BoxLayout, but then shift the right-hand component 30 pixels to the left.

Is there any way I can do this? I tried overriding calcPreferredSize() in the left-hand component and reducing the size it returns, but this also crops that component. Maybe there is a way of making the layout/ui manager think the left-hand component is, lets say, 50px when calculating where to lay everything out, but think its 100px when drawing it?

Any suggestions welcome
Thanks very much

Shai (not Almog!)

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
chen

Hi Shai (not Almog!),
Currently there is no way to draw Components 1 over the other(we are
considering a few options).
You will have to create your own Component to do that

Regards,
Chen

lwuit-users@mobileandembedded.org wrote:
> Hi
>
> I want to place a component overlapping on top of another component; that is, have the two components next to each other in an X-AXIS BoxLayout, but then shift the right-hand component 30 pixels to the left.
>
> Is there any way I can do this? I tried overriding calcPreferredSize() in the left-hand component and reducing the size it returns, but this also crops that component. Maybe there is a way of making the layout/ui manager think the left-hand component is, lets say, 50px when calculating where to lay everything out, but think its 100px when drawing it?
>
> Any suggestions welcome
> Thanks very much
>
> Shai (not Almog!)
> [Message sent by forum member 'shai126' (shai126)]
>
> http://forums.java.net/jive/thread.jspa?messageID=284571
>
> ---------------------------------------------------------------------
> 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

shai126
Offline
Joined: 2008-07-06

Any tips on how I can do that? Create a custom component for the left one or the right one? The left one is supposed to be a list and the right one a container (holding labels etc.) - can I just extend List or Container to do this? Which methods do I need to be looking at overriding?

Thanks very much

Shai

chen

Hi,
Currently this is not a trivial task, you can extend Container and
layout the Components yourself.
That means you need to create a custom container that don't use any
layout(you will have to determine the positions of the Components) keep
some sort of a Z - ordering for each Component you added, and then paint
the Components within according to the z- ordering value or according to
the order you added the Components.
Notice, you will have to make sure that when a repaint happens to one of
the Components all the overlapped Components needs to repaint as well.

Regards,
Chen

lwuit-users@mobileandembedded.org wrote:
> Any tips on how I can do that? Create a custom component for the left one or the right one? The left one is supposed to be a list and the right one a container (holding labels etc.) - can I just extend List or Container to do this? Which methods do I need to be looking at overriding?
>
> Thanks very much
>
> Shai
> [Message sent by forum member 'shai126' (shai126)]
>
> http://forums.java.net/jive/thread.jspa?messageID=284575
>
> ---------------------------------------------------------------------
> 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