Max Still Hangs with SwingUtilities.invokeLater…

Apr 3, 2006 at 12:52pm

Max Still Hangs with SwingUtilities.invokeLater…

Hi,

I’ve found another problem, not sure it’s a bug.
I’m often working with mxjs containing Jframes.
When the object is deleted, I want the Jframe to be destroyed.
I use the notifyDeleted method to do this.
It works, if I delete the box manually or via scripting, but when the Jframe
is open and I edit the mxj box (for example to add a argument), max hangs
though I use the SwingUtilities.invokeLater…. method.
Am I doing something wrong ?

See example below.

DelTest.java

import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import com.cycling74.max.MaxObject;

public class DelTest extends MaxObject
{
JFrame frame;

public DelTest()
{
frame = new JFrame(“test”);
frame.setSize(200,200);
frame.setLocationRelativeTo(null);
}

public void notifyDeleted()
{
post(“deleting…”);
close();
}

public void open()
{
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
frame.setVisible(true);
}
});
}

public void close()
{
SwingUtilities.invokeLater(new Runnable()
{
public void run()
{
frame.setVisible(false);
}
});
}

public void dblclick()
{
open();
}
}

#P window setfont “Sans Serif” 9.;
#P user ubumenu 210 203 100 196617 0 1 1 0;
#X add open;
#X add close;
#X prefix_set 0 0 0;
#P objectname func;
#P window linecount 2;
#P message 96 160 239 196617 new test newex 255 228 65 196617 mxj DelTest ,
connect func 1 test 0;
#P window linecount 1;
#P newex 85 200 75 196617 prepend script;
#P message 85 141 58 196617 delete test;
#N thispatcher;
#Q end;
#P newobj 85 222 65 196617 thispatcher;
#P newex 255 228 65 196617 mxj DelTest;
#P objectname test;
#P window linecount 2;
#P comment 79 103 270 196617 Max hangs when editing the mxj box while the
JFrame is open. Deleting the box manually or via scripting works;
#P fasten 5 0 4 0 101 192 90 192;
#P connect 3 0 4 0;
#P connect 4 0 2 0;
#P connect 6 1 1 0;
#P window clipboard copycount 7;

#25206

You must be logged in to reply to this topic.