Search code examples
javaimagejava-melabellwuit

LWUIT Label: Using image as a label


I am using LWUIT but a problem I have is that when I use an image as a label like this:

mapScreen = new Form("Map");
        try 
        {
            Image image = Image.createImage("/res/Map_new_1.jpg");
            mapScreen.addComponent(new Label(image));
        } catch (Exception e) 
        {
            System.out.print("Error\n\n"+e.getMessage());
            mapScreen.addComponent(new Label(e.getMessage()));
        }

I am able to display the image even though it is larger than the screen of the mobile phone. I am also able to scroll vertically but I am not able to scroll horizontally. How can I fix this problem so that I will also be able to scroll horizontally?

Thanks.


Solution

  • You can try to use Form.setScrollableX(true);