RedJWindow wrapper for JSCWindow


superclass: JSCWindow


adding some functionallity to the standard window class.

requires RedVector and SwingOSC


note!  uncomment the code in RedJWindow.sc and recompile if you're using swingosc.



see also [RedWindow], [SCWindow]


instance methods:

draw(func)

alias for drawHook_

play(fps= 40)

starts an internal thread on the AppClock updating at rate fps

stop

stop internal thread

resize([width, height])

change window size while keeping x and y position.  the argument can also be a RedVector

background_(color)

set window background.  alias for w.view.background_

isOpen

boolean


instance variables:

<mouse

returns a RedVector for mouse x and y position.  click&drag in window to set position.

<isPlaying

if the window is updating

<userView

access to the embedded view



w= RedJWindow.new.front;

w.close;


//or better - for platform independet code...

GUI.swing;

w= GUI.redWindow.new.front;


w.resize(RedVector2D[200, 200])

w.background_(Color.red)


w.draw{GUI.pen.fillOval(Rect.aboutPoint(175.rand@175.rand, 50, 50))}

w.play(25) //25fps

w.stop


( //mouse control

w.draw{

var radius= 100.rand;

GUI.pen.strokeColor_(Color.red(0.5, radius/100));

GUI.pen.fillOval(Rect.aboutRedVector2D(w.mouse, radius))

}

)

w.play(25) //25fps

w.mouse

w.isPlaying

w.isOpen

w.stop

w.close