Search code examples
javajava-melwuit

how to put ad banner in j2me using lwuit?


I want to put a advertisement banner at the bottom of the screen of my j2me application. How can i set a container fixed at a position so even if the page is scrolled that specific container will be still visible? If not some other way to put up a ad banner above or below the command buttons.


Solution

  • Place the add image in a Button, set the layout of the form to BorderLayout and set the form to scrollable false. Place the button in BorderLayout.SOUTH and your content in a Container (that you can set to scrollable Y true) in the center e.g.:

    myForm.setScrollable(false);
    Button ad = new Button(adAction);
    myForm.setLayout(new BorderLayout());
    myForm.addComponent(BorderLayout.SOUTH, ad);
    Container actualContent = new Container();
    myForm.addComponent(BorderLayout.CENTER, actualContent);
    actualContent.setScrollableY(true);