GUIs with Max

JavaProgrammer's icon

Hi all.

Do many people here create GUIs in Java, using Swing etc., for use with Max/MSP?

Is it possible to have a Java panel in a max patch, rather than a Frame floating around? Sort of like an Applet?

Dan Nigrin's icon

No, Java-based GUIs using Swing, etc.. must live in their own window.

Dan

Matthew Aidekman's icon

it's possible by using the paint methods to draw to matrix objects..

JavaProgrammer's icon

Thanks for the replies all.

Matthew Aidekman wrote on Fri, 08 May 2009 05:27it's possible by using the paint methods to draw to matrix objects..

By that I presume you mean by outputting messages such as "line", clear, etc. to the matrix object, as in some of the early Max tutorials. Except they sent the messages manually, rather than from java.

Or, can you obtain an external reference to the matrix object and can then use a paint method paint( Graphcis g ), wtih the g being the Graphics context of the external matrix object?

ch's icon

Quote:
Is it possible to have a Java panel in a max patch, rather than a Frame floating around? Sort of like an Applet?

Well, you can embed an applet in max actually :

Max Patch
Copy patch and select New From Clipboard in Max.

and then talk to max via osc..
not really efficient I guess, but quite fun
Ch.

JavaProgrammer's icon

How are these patches encoded? It doesn't look like uuencode.

I'd very much like to try the Applet example.

ch's icon

How to post patches to the forum :

The code I posted is just a [jweb], with a url pointing to an applet.

nick rothwell | project cassiel's icon

Don't try this at home, boys and girls, if you've already loaded a JVM via the MXJ object. Oof! Ouch! Bang! Crunch! Argh!

Oh, and since you're really in a web browser context here, the Java environment will be heavily sandboxed and probably can't do OSC or much else.

JavaProgrammer's icon

I'll be careful about the applet thing if a JVM is already loaded.

Applets that aren't served across the web aren't limited to the sandbox, and can read/write local disk etc. So OSC shouldn't be a problem. On a local machine.

There might be a way around the floating Java window thing. If a Max patcher can find out its position on the screen, then a Java GUI (with or without decorations) could then follow it around. Even better if Max can detect when its patcher window is minimised, activated, etc. Are there Max objects to do this? If so, I'd like to try making

If Max can't do it, Java itself might be able to do something. You could put a fixed image on the Max patch window. Java could then do a screengrab, find the picture, and move the window to the right location.