When I try to align the fields vertically, they do not behave as I expected (Blackberry JDE4.5.0 eclipse)

I am using the Eclipse plugin and JDE 4.5.0. How to align the fields vertically. Can we align the type of field LEFT_BOTTOM, RIGHT_BOTTOM, LEFT_VCENTER, RIGHT_VCENTER, CENTER(vertical and horizontal), BOTTOM_CENTERetc ....?

+2
source share
2 answers

BlackBerry UI field managers are known to be annoying when working with field alignment. Managers seem to ignore all style flags (eg HCENTER, VCENTERetc.) Therefore, the only way to do it - to redefine a method sublayoutin your manager and do it yourself.

, , . , , , , .

VerticalFieldManager    mainmanager     = new VerticalFieldManager(Field.USE_ALL_WIDTH | Field.USE_ALL_HEIGHT)
{
    protected void sublayout( int width, int height ) {

        super.sublayout( width, height );

        width = getWidth();
        height = getHeight();

        for (int i = 0;i < this.getFieldCount() - 1; i++)
        {
            Field field = this.getField(i);
            //this positions the item in the middle of the manager
            int x = (int)((width - field.getWidth()) * 0.50);
            setPositionChild(field, x, field.getTop());
        }
    }

, USE_ALL_WIDTH USE_ALL_HEIGHT . , , .., . , x , y - .

(, , ), sublayout, , .

, .:)

+7

HorizontalFieldManager , VerticalFieldManager . . ++

+1

All Articles