Search code examples
java-melwuitlwuit-form

How place the components the front of another one?


I want to place the components A and B over component with List. I need that would text of list will be to visible. I can not find which layout can do it. How this behavior is in lwuit? What solutions exist?

enter image description here


Solution

  • The question is somewhat unclear, jmunoz answer is correct if you want component's A and B to reside at the bottom of the screen and the list to scroll above. However from the drawing it seems you want an "always on top" effect which you can achieve either via a glass pane (for non-interactive components) or via the LayeredLayout class.

    This is actually quite simple using the following:

    myForm.setLayout(new LayeredLayout());
    myForm.setScrollable(false);
    
    // will occupy the entire area of the form but should be scrollable
    myForm.addComponent(componentUnderneath);
    Container south = new Container(new BorderLayout());
    myForm.addComponent(south);
    south.addComponent(BorderLayout.SOUTH, whateverYouWantToPlaceOnTopInTheSouth);