Skip to main content

disabling transparency

11 replies [Last post]
pandora808
Offline
Joined: 2004-07-06
Points: 0

i've noticed that the slowest part of the lwuit demo is in the menu (softkey and list) with transparent highlights, is there a way to (programatically) disable transparency in the softkey menu for better performance? I'm just trying stuff out in a little helloworld.

Reply viewing options

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

Hi,
this is defined in the renderer too by the getListFocusComponent
method. You can change opacity but I'm not sure if it will look good
try something like this in your list cell renderer:

private Label focus = new Label("");
public Component getListFocusComponent(List list) {
focus.getStyle().setBgTranspacrency(0);
focus.setBorderPainted(true);
return focus;
}

Hope this will act more like you want it should draw a border while
moving the animation.

To disable the animation completely just invoke
List.setSmoothAnimation(false);

Thanks,
Shai.

> sorry for the confusion, yes your example code did what I was
> looking for, so thank you!
>
> After making the selection fully opaque, I saw what was happening,
> I guess it's just a "feature" of lwuit, that when you select items
> in the softkey menu, it fades the transparency while it's
> animating. So despite me making the item (statically) opaque, the
> renderer is fading it in/out while it animates to the next selected
> menu item. is there a quick way to alter that?
> [Message sent by forum member 'pandora808' (pandora808)]
>
> http://forums.java.net/jive/thread.jspa?messageID=285502
>
> ---------------------------------------------------------------------
> 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

pandora808
Offline
Joined: 2004-07-06
Points: 0

also, my concern is more about the selected item's background color, not the menu container's background color. will this work for that too?

Shai Almog

I don't understand the question, please just try it and see whether
it does what you expect.

Thanks,
Shai.

> also, my concern is more about the selected item's background
> color, not the menu container's background color. will this work
> for that too?
> [Message sent by forum member 'pandora808' (pandora808)]
>
> http://forums.java.net/jive/thread.jspa?messageID=285186
>
> ---------------------------------------------------------------------
> 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

pandora808
Offline
Joined: 2004-07-06
Points: 0

sorry for the confusion, yes your example code did what I was looking for, so thank you!

After making the selection fully opaque, I saw what was happening, I guess it's just a "feature" of lwuit, that when you select items in the softkey menu, it fades the transparency while it's animating. So despite me making the item (statically) opaque, the renderer is fading it in/out while it animates to the next selected menu item. is there a quick way to alter that?

pandora808
Offline
Joined: 2004-07-06
Points: 0

ok, well i set list.setSmoothScrolling(false) and it fixed that one just by eliminating the animation that works for me

Neto Marin

component.getStyle().setBgTransparency(0);

;-)
[]s
Neto

On Wed, May 28, 2008 at 4:10 PM, wrote:

> i've noticed that the slowest part of the lwuit demo is in the menu
> (softkey and list) with transparent highlights, is there a way to
> (programatically) disable transparency in the softkey menu for better
> performance? I'm just trying stuff out in a little helloworld.
> [Message sent by forum member 'pandora808' (pandora808)]
>
> http://forums.java.net/jive/thread.jspa?messageID=277085
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>

--
Antonio Marin Neto
Sun Certified Programmer for Java 2 Platform 1.4

GSM Mobile: +55 19 8166 6720
Blog: http://weblogs.java.net/blog/netomarin/
GTalk: netomarin@gmail.com
Skype: netomarin
[att1.html]

Shai Almog

Or the other way around:
component.getStyle().setBgTransparency(255);

;-)

> component.getStyle().setBgTransparency(0);
>
> ;-)
> []s
> Neto
>
> On Wed, May 28, 2008 at 4:10 PM, > users@mobileandembedded.org> wrote:
> i've noticed that the slowest part of the lwuit demo is in the menu
> (softkey and list) with transparent highlights, is there a way to
> (programatically) disable transparency in the softkey menu for
> better performance? I'm just trying stuff out in a little helloworld.
> [Message sent by forum member 'pandora808' (pandora808)]
>
> http://forums.java.net/jive/thread.jspa?messageID=277085
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@lwuit.dev.java.net
> For additional commands, e-mail: users-help@lwuit.dev.java.net
>
>
>
>
> --
> Antonio Marin Neto
> Sun Certified Programmer for Java 2 Platform 1.4
>
> GSM Mobile: +55 19 8166 6720
> Blog: http://weblogs.java.net/blog/netomarin/
> GTalk: netomarin@gmail.com
> Skype: netomarin

[att1.html]

pandora808
Offline
Joined: 2004-07-06
Points: 0

ok cool that makes sense, but how do I get a reference to the softkey menu item component ?

Shai Almog

You don't need to, the renderer will be invoked with every item in
the menu as it is shown.

> ok cool that makes sense, but how do I get a reference to the
> softkey menu item component ?
> [Message sent by forum member 'pandora808' (pandora808)]
>
> http://forums.java.net/jive/thread.jspa?messageID=285177
>
> ---------------------------------------------------------------------
> 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

pandora808
Offline
Joined: 2004-07-06
Points: 0

so you're saying:

component.getStyle().setBgTransparency(255);

will cause all bg to be transparent for all components using that style?

Shai Almog

Hi Pandora,
no.

First 255 will set the current component to be opaque (opposite of
transparency), use 0 instead. However this will only work for the
current component and never globally.
To set these things globally look at setting a theme. For the case of
the menu just do something as simple as this:

myForm.setMenuCellRenderer(new DefaultListCellRenderer() {
public Component getListCellRendererComponent(List list,
Object value, int index, boolean isSelected) {
Component c = super.getListCellRendererComponent
(list, value, index, isSelected);
if(isSelected) {
c.getStyle().setBgTransparency(255);
}
return c;
}
);

Thanks,
Shai.

> so you're saying:
>
> component.getStyle().setBgTransparency(255);
>
> will cause all bg to be transparent for all components using that
> style?
> [Message sent by forum member 'pandora808' (pandora808)]
>
> http://forums.java.net/jive/thread.jspa?messageID=285183
>
> ---------------------------------------------------------------------
> 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