SwingOSC – Java-based GUI classes

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

no-op / not working
multi-linemulti-line text wrap is not possible (you might use JSCTextView instead)
different behaviour
abbreviationtext label is abbreviated when width too small

 

JSCStaticText

Note: please use the abstraction layer GUI.staticText if possible! (see GUI)

A non-editable static text (label) field.

(
    var w, f, t;
    w = JSCWindow.new;
    f = FlowLayout.new( w.view.bounds );
    w.view.decorator = f;
    t = "The quick brown fox";
    JSCStaticText( w, Rect( 20, 20, 340, 30 )).string_( t ).align_( \left );
    f.nextLine;
    JSCStaticText( w, Rect( 20, 20, 340, 30 )).string_( t ).align_( \center );
    f.nextLine;
    x = JSCStaticText( w, Rect( 20, 20, 340, 30 )).string_( t ).align_( \right );
    w.front;
)

x.font = JFont( "SansSerif", 20 );
x.background = Color.yellow;

Note that in recent SC versions, you can use Umlaute directly in Strings:

x.string = "Überraschung";

In previous versions, and in Psycollider, you have to do a trick to get the proper UTF-8 encoding (www.utf8-zeichentabelle.de):

x.string = "" ++ 0xC3.asAscii ++ 0x9C.asAscii ++ "berraschung"; // Ü occupies two bytes here!