SwingOSC – Java-based GUI classes

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

no-op / not working
typingColornot effective
different behaviour
class hierarchyJSCTextField and JSCNumberBox are subclasses of JSCTextEditBase
alignmentdefault alignment is right (more useful for numbers)
extended functionality
minDecimalsadjust the minimum number of decimals that is displayed
maxDecimalsadjust the maximum number of decimals that is displayed
known issues / todo
actionspressing escape will not fire an action

 

JSCNumberBox

Note: please use the abstraction layer NumberBox if possible!

A view to type in integer or decimals numbers.

(
    var w;
    
    w = JSCWindow( "JSCNumberBox" );
    b = JSCNumberBox( w, Rect( 10, 10, 100, 30 ));
    b.value = rrand( 1, 15 );
    b.action = { arg numb; numb.value.postln };
    w.front;
)

// does not do the action
b.value = rrand( 1, 15 );

b.background = Color.grey;
b.stringColor = Color.green;
b.align = \center;

// minimum / maximum number of decimals (works only with SwingOSC!)
b.value = 3.1;
b.minDecimals = 2;
b.value = pi;
b.maxDecimals = 3;

default keyboard mappings

... not active at the moment! most keyboard events are handled by the look-and-feel

returncommit edit
csr up/downincrease/decrease value by 1.0