Forums > Java

Adding Max objects to a JFrame?

November 27, 2006 | 7:42 pm

Sorry for cross posting, (i’ve got a similar question on the Max/MSP forum), but as i’ve had no replies i suspect it’s probably better posted here.

I suspect it isn’t possible from what i’ve found in the archives but can anyone clarify that for me?
(and thusly save me days of headbanging).

I’d like to add, (for example), a kslider to a Java UI which loads when the Collective launches and therefore allow the user to interact with my patch through a Java front end interface, (with the patch and actual processing running in the background).

Logically, and very simplisticly, the code would look something like this:

JFrame j = new JFrame("example");
KSlider k = new KSlider(small);
j.add(k);
j.setVisible(true);
j.pack();

I’m assuming it’s not possible because nobody’s written a Class called KSlider yet…but is this actually the case?

Thanks in advance,
John


November 27, 2006 | 8:06 pm

Hi John,

The Max objects are not designed to work in a Java UI.

Ben

On 11/27/06, john inder wrote:
>
> Sorry for cross posting, (i’ve got a similar question on the Max/MSP forum), but as i’ve had no replies i suspect it’s probably better posted here.
>
> I suspect it isn’t possible from what i’ve found in the archives but can anyone clarify that for me?
> (and thusly save me days of headbanging).
>
> I’d like to add, (for example), a kslider to a Java UI which loads when the Collective launches and therefore allow the user to interact with my patch through a Java front end interface, (with the patch and actual processing running in the background).
>
> Logically, and very simplisticly, the code would look something like this:
>
> JFrame j = new JFrame("example");
> KSlider k = new KSlider(small);
> j.add(k);
> j.setVisible(true);
> j.pack();
>
> I’m assuming it’s not possible because nobody’s written a Class called KSlider yet…but is this actually the case?
>
> Thanks in advance,
> John
> –
> Imagination is more important than knowledge – A. Einstein
>


November 27, 2006 | 9:05 pm

> and therefore allow the user to interact with my patch through a
> Java front end interface, (with the patch and actual processing
> running in the background).
>

This part is possible. You can’t embed max UI objects in a java frame
but you could make a whole java ui that interacts with your patch.
You have an mxj object which created a frame and set up the ui etc.
Then you would communicate with the max patch via messages sent
out from that mxj instance.
topher


November 30, 2006 | 5:28 pm

Thanks for your replies, i had suspected that was the case because there don’t seem to many patches out there with a Java front-end!

It’s definitely a trade off, Java UI widgets or the Max objects, and the Max objects are almost always going to win out, somethings are replicable with widgets…but things like [scope~] and [jit.pwindow] just aren’t!!!

I can see certain situations where i’d use a Java front-end, but on the whole it’d be more hassle than it’s worth, so it looks like i’m going to have to try braving [LCD] and see where i end up with it.

Thanks again,
John


November 30, 2006 | 6:53 pm

> I can see certain situations where i’d use a Java front-end, but on the whole it’d be more hassle than it’s worth, so it looks like i’m going to have to try braving [LCD] and see where i end up with it.

Since you are comfortable programming in a text-based language you
might enjoy making your UI components with jsui!

Ben


November 30, 2006 | 7:00 pm

You can check out the filebrowse stuff to see how java and LCD can be
used together
to make your life a little easier if you go the LCD route.

http://www.cycling74.com/twiki/bin/view/Share/TopherLafata

t

On Nov 30, 2006, at 17:28 PM, john inder wrote:

>
> Thanks for your replies, i had suspected that was the case because
> there don’t seem to many patches out there with a Java front-end!
>
> It’s definitely a trade off, Java UI widgets or the Max objects,
> and the Max objects are almost always going to win out, somethings
> are replicable with widgets…but things like [scope~] and
> [jit.pwindow] just aren’t!!!
>
> I can see certain situations where i’d use a Java front-end, but on
> the whole it’d be more hassle than it’s worth, so it looks like i’m
> going to have to try braving [LCD] and see where i end up with it.
>
> Thanks again,
> John
> –
> Imagination is more important than knowledge – A. Einstein


December 1, 2006 | 3:21 pm

Thanks for the suggestion about [jsui] Ben, i have looked into Javascript and i’d have though i could implement it fairly functionally into a website now…but looking at [jsui] code seems like a whole different ball game at the moment!
(Of course i also remember being utterly overwhelmed the first time i saw Max too, so i’m sure i’ll get there with it eventually).

Topher, thanks for the link to your filebrowse stuff. I’ve only had a brief look at the code and haven’t opened it in my IDE yet, (which makes it much easier to read than in notepad), although it looks pretty damned useful!

I think with a combination of LCD, (most likely instantiated through Tophers filebrowser classes), [jsui] and the Max UI objects i should be able to create some pretty good UIs. So thank you both for your help, it’s appreciated!

John


Viewing 7 posts - 1 through 7 (of 7 total)