Skip to main content

dlcr.getSelectedStyle.setBgColor() does not work

1 reply [Last post]
B3DA
Offline
Joined: 2011-11-25
Points: 0

Hi all

I'm newbie to lwuit.

I've created a simle list, but I can't set the bg color for selected items. Of course bgColor works for Unselected items.

By the way, other styles such as font and fgColor works for selected items.

Here's my code:

...

String[] items = {"Red", "Green","Blue"};

DefaultListModel simpleModel = new DefaultListModel();

DefaultListCellRenderer dlcr = new DefaultListCellRenderer();

List lst = new List(simpleModel);

dlcr.getSelectedStyle().setBgColor(0xff0000);

...

But the result is a white rectangle arount the selected item

Thanks.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
vprise
Offline
Joined: 2003-11-07
Points: 0

I'm guessing the items transparency is 0 which is why you see this. However, what you would want to customize is the color of the focus component which is the element that moves behind the selected item.