I'm making an MDI on top of Matlab (with JDesktopPane), and it would
be nice to be able to include Matlab figures in it. One way would be
if you could put a Matlab figure into a Java container (in this case
JInternalFrame) but I suspect this is not possible... unless someone
has found some undocumented stuff.
The alternative would be to abandon Matlab grapohics and just pass
the data to a suitable Java class for plotting in the MDI, but that
seems a shame.
Any ideas?
Cheers,
Arwel.
I suggest you download FINDJOBJ from the File Exchange to find out
how Matlab figures and components are implemented using Java Swing
components. If you use FINDJOBJ with no output params it displays a
graphical listing of the component hierarchy. This will make it
easier for you to decide how to incorporate Matlab figs into your
MDI.
Yair Altman
In the ideal case I suppose, it would be to hijack 'plot' so that I
could send plots to an axis in a panel in my Java gui. So
plot(hx,...) would point to matlab axes siting in a Java container.
Alternatively, I imagine it would be possible to plot the figure in
Matlab (but hidden), and then take the appropriate component from
this (i.e. the content pane containing the completed figure) and then
put the fully completed figure in my Java container.
Option 2 seems the most reasonable. Do you think this will work?? If
so, I would really welcome some clues as to how this might be done if
you know!
Many Thanks,
Arwel
> In the ideal case I suppose, it would be to hijack 'plot' so that I
> could send plots to an axis in a panel in my Java gui. So
> plot(hx,...) would point to matlab axes siting in a Java container.
Unfortunately, it seems we cannot add Matlab axes (or any other
Matlab component) to a non-Matlab container like JPanel, despite this
being requested from TMW years ago (not by me). Moreover, Matlab axes
are virtual objects - the physical drawing is apparently done
directly on the Graphics canvas, and so is not accessible. So unless
I learn something new, this option appears impossible.
Regarding the second option, it looks reasonable at first glance. I
would search Java forums for hints on how to implement this, as this
becomes an almost pure-Java question.
Yair Altman