|
It worked.
Concerning "{@funMove}". I know what you mean, but i'm going
to use some parameters. But thanks for help.
If i run this code, using F5 (means all at once)
f=figure;
jf=get(f,'JavaFrame');
jb=jf.fFigureClient.getFrameProxy;
set(jb,'ComponentMovedCallback',@funMove);
I get this error.
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown
Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
com.mathworks.jmi.bean.MatlabBeanInterface.addCallback(MatlabBeanInterface.java:691)
at
com.mathworks.jmi.bean.MatlabCallbackInterface.addCallback(MatlabCallbackInterface.java:128)
Caused by: java.lang.Error: FigureFrame object is NULL
at
com.mathworks.hg.peer.FigureFrameProxy.getClientFrame(FigureFrameProxy.java:208)
at
com.mathworks.hg.peer.FigureFrameProxy.addComponentListener(FigureFrameProxy.java:285)
... 6 more
It seems that the figure object is not fully created when
the second line is executed.
It doesn't happen if i step through the code with F9. So far
so good.
Is there a way to prevent this error?
Rico
"Yair Altman" <altmanyDEL@gmailDEL.comDEL> wrote in message
<fh13j5$6io$1@fred.mathworks.com>...
> "Rico Saupe" <rico.saupe@valentum.de> wrote in message
> <fh123b$cmm$1@fred.mathworks.com>...
> > Thank you, I've tried it before, but it did not work.
> >
> > f=figure;
> > jb = get(f,'JavaFrame');
> > set(jb,'ComponentMovedCallback',{@funMove});
> > % isn't working, because jb is of type
> > com.mathworks.hg.peer.FigurePanel and not javax.swing.JFrame
> >
> > Maybe I should try something like this
> >
> > compl =
> com.mathworks.hg.peer.FigurePeerComponentListener(???);
> > jb.addFigurePeerComponentListener(compl);
> >
> > But with what parameters? It's not documented.
>
> ok, the following works:
> jf=get(f,'JavaFrame');
> jb=jf.fFigureClient.getFrameProxy;
> set(jb,'ComponentMovedCallback',@funMove);
>
> note: you don't need {} around your @funMove unless you add
> user-specified extra args.
>
> Download my FindJObj submission from the File Exchange to
> see the Java component hierarchy underlying the Matlab GUI:
>
http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=14317
>
> Yair Altman
|