HelloWorld
HelloWorld

Reputation: 2355

How to get Codename One Form feature vertical scroll?

My Codename One app features a Form with 3 SpanLabels containing text and one Container in LayeredLayout with an image and an overlay.

    this.add(BorderLayout.NORTH, spanLab1);
    this.add(BorderLayout.CENTER, imageCont);
    this.add(BorderLayout.SOUTH, BoxLayout.encloseY(spanLab2, spanLabl3));

This yields to the following:

Form not scrollable (text is irrelevant)

This is not satisfactory as the image (that appears in the center and should be CN1 icon) is not scaled but cut because it is not possible to scroll down.

I tried to force the Form to be scrollable (this.setScrollableY(true)) without success.

Did I make a mistake somewhere, for example should all my content be placed in the BorderLayout.CENTER since according to the documentation the NORTH position is dedicated for the title and the SOUTH one for an optional menu bar (I tried this without success)?

Or should I show a Dialog instead (that offers Y-Scroll out of the box) ? What is actually the proper way to show all my (long) content with no picture cut or text overlaping ?

EDIT December 22nd 2016

As @Tizbn wrote the Form's ContentPane has to be in Vertical BoxLayout. So the call to the parent constructor has to be written :

super(new BoxLayout(BoxLayout.Y_AXIS));

Thank you very much for any help!

Upvotes: 1

Views: 296

Answers (1)

tizbn
tizbn

Reputation: 1907

Vertical Scroll is disable in BorderLayout . For that BoxLayout with Y-axis can be used and make setScrollableY(true) in the Boxlayout. Hope it will help .

Upvotes: 2

Related Questions