Question

I've created an apps using LWUIT. It use the header bar, like this

enter image description here

It use the container. Under this header bar container I've created the scroll able list.

The strange part is, if I scroll this list, the color of the button (the menu button and filter button) in header bar changed. And it just happened when I tried the apps in device. When I try using it in emulator it just fine

Here is the code of the button I've created

    b_menu.getUnselectedStyle().setBorder(null);
    b_menu.getSelectedStyle().setBorder(null);
    b_menu.getPressedStyle().setBorder(null);
    b_menu.setIcon(ImageUtil.loadImage("/menu.png"));
    b_menu.setRolloverIcon(ImageUtil.loadImage("/menu.png"));
    b_menu.setPressedIcon(ImageUtil.loadImage("/menu.png"));
    b_menu.setName("menu");
    b_menu.getStyle().setBgTransparency(0);
    b_menu.getStyle().setBgPainter(new LinearGradientPainter(0xcf266a, 0xcf266a, false));
    b_menu.getSelectedStyle().setPadding(5, 5, 5, 5);
    b_menu.getSelectedStyle().setMargin(0, 0, 0, 0);
    b_menu.getUnselectedStyle().setPadding(5, 5, 5, 5);
    b_menu.getSelectedStyle().setMargin(0, 0, 0, 0);
    b_menu.getSelectedStyle().setBgColor(0xcf266a, false);
    b_menu.getSelectedStyle().setBgTransparency(0);
    b_menu.getSelectedStyle().setBgPainter(new LinearGradientPainter(0xcf266a, 0xcf266a, false));
    b_menu.getUnselectedStyle().setBgTransparency(0);
    b_menu.getUnselectedStyle().setBgPainter(new LinearGradientPainter(0xcf266a, 0xcf266a, false));
    b_menu.getPressedStyle().setBgTransparency(0);
    b_menu.getPressedStyle().setBgPainter(new LinearGradientPainter(0xcf266a, 0xcf266a, false));

Have you ever met and solve this problem?

Regards

Giri

Was it helpful?

Solution

Oh, the answer is I also have to change the unselected style. Here the code

    b_menu.getUnselectedStyle().setBorder(null);
    b_menu.getSelectedStyle().setBorder(null);
    b_menu.getPressedStyle().setBorder(null);

    b_menu.setIcon(ImageUtil.loadImage("/menu.png"));
    b_menu.setRolloverIcon(ImageUtil.loadImage("/menu.png"));
    b_menu.setPressedIcon(ImageUtil.loadImage("/menu.png"));

    b_menu.setName("menu");

    b_menu.getStyle().setBgTransparency(0);
    b_menu.getStyle().setBgPainter(new LinearGradientPainter(0xcf266a, 0xcf266a, false));

    b_menu.getSelectedStyle().setPadding(5, 5, 5, 5);
    b_menu.getSelectedStyle().setMargin(0, 0, 0, 0);
    b_menu.getSelectedStyle().setBgTransparency(0);
    b_menu.getSelectedStyle().setBgPainter(new LinearGradientPainter(0xcf266a, 0xcf266a, false));

    b_menu.getUnselectedStyle().setPadding(5, 5, 5, 5);
    b_menu.getUnselectedStyle().setMargin(0, 0, 0, 0);
    b_menu.getUnselectedStyle().setBgTransparency(0);
    b_menu.getUnselectedStyle().setBgPainter(new LinearGradientPainter(0xcf266a, 0xcf266a, false));

    b_menu.getPressedStyle().setBgTransparency(0);
    b_menu.getPressedStyle().setBgPainter(new LinearGradientPainter(0xcf266a, 0xcf266a, false));

    b_menu.addActionListener(this);
    b_menu.repaint();

Thanks for viewing this question!

Regards

Giri

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top