## SwingOSC – Java-based GUI classes

This class is meant as an emulation of SCHLayoutView. last mod: 17-jul-09 sciss
Also refer to JSCView for different behaviour affecting all widgets

# JSCVLayoutView

Note: please use the abstraction layer VLayoutView if possible!

A container view that lays out all its children vertically from top to bottom. For the horizontal version, see JSCHLayoutView.

    (
    q = 10;
    w = JSCWindow.new;

    h = JSCVLayoutView(w,Rect(0,0,300,300));

    Array.fill(q,{ arg i;
        JSCRangeSlider(h,Rect(0,0,75,20)).hi_(i / q);
    });

    w.front
    )

### elastic

Resize the window to see the effect.

    // note: children can never exceed the bounds
    // of their parent container in swing !!
    (
    q = 10;
    w = JSCWindow.new;

    h = JSCVLayoutView(w,Rect(10,10,300,300));
    h.background = Color.red(alpha:0.2);
    h.resize = 5; // elastic
    Array.fill(q,{  arg i;
        var s;
        s = JSCRangeSlider(h,Rect(0,0,75,20)).hi_( i / q );
        s
    });

    w.front
    )

    // Contents are elastic
    (
    q = 10;
    w = JSCWindow.new;
    h = JSCVLayoutView(w,Rect(10,10,300,300));
    h.background = Color.red(alpha:0.2);
    h.resize = 5; // elastic
    Array.fill(q,{  arg i;
        var s;
        s = JSCRangeSlider(h,Rect(0,0,75,20)).hi_( i / q );
        s.resize = 5; // elastic
        s
    });

    w.front
    )

    // set minHeight on contents
    (
    q = 5;
    w = JSCWindow.new;

    h = JSCVLayoutView(w,Rect(10,10,300,300));
    h.background = Color.red(alpha:0.2);
    h.resize = 5; // elastic

    Array.fill(q,{  arg i;
        var s;
        s = JSCRangeSlider(h,Rect(0,0,75,20)).hi_( i / 5 );
        if(i < 2,{
            s.resize = 5; // some elastic
            s.setProperty(\minHeight,20);
        },{
            s.resize = 1; // some not elastic
        });
        s
    });

    w.front
    )

    (
    q = 5;
    w = JSCWindow.new;

    h = JSCVLayoutView(w,Rect(0,0,300,300));
    h.background = Color.red(alpha:0.2);
    h.resize = 5; // elastic

    Array.fill(q,{  arg i;
    	var s;
    	s = JSCRangeSlider(h,Rect(0,0,75,20));

    	s.hi = i / 5;
    	s.resize = 5;
    	s.setProperty(\minHeight,20);
    	s.setProperty(\maxHeight,40);
    	s
    });

    w.front
    )

### Spacing

Default spacing between components is 4 pixels. You can alter this value but setting the 'spacing' property:

    (
    q = 10;
    w = JSCWindow.new;

    v = JSCVLayoutView(w,Rect(10,10,300,300));
    v.spacing = 0;  // no padding

    Array.fill(q,{
        JSCRangeSlider(v,Rect(0,0,75,20))
    });

    w.front
    )

    v.spacing = 8;