Question

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

Était-ce utile?

La 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);

Autres conseils

You must do the following:

The Form must not do scroll. Use Form.setScrollable(false). Set the layout of the ´Form´ to BORDER_LAYOUT, myForm.setLayout(new BorderLayout()) . Ok in BorderLayoutyou can put the components in the Form as you want.

Put the Listcomponent in the center of the BorderLayout with myForm.addComponent(BorderLayout.CENTER, List) and the other two elements in the south of the layout using

Container southContainer = new Container();
southContainer.addComponent(A);
southContainer.addComponent(B);
myForm.addComponent(BorderLayout.SOUTH, southContainer)

With this you can get a scrollable Listand two elements always visible.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top