As pointed out by Yair Altman in his very popular blog (http://undocumentedmatlab.com/), accessing the java properties of a figure window allows for making figures being dockable even in standalone applications. Unfortunately, the figures container contains menu items (Plot Browser, Figure Palette and Property Editor) which directly lead to crashes of the whole application.
To overcome this shortcoming, a function is supplied which removes the problematic (or unwanted) menu entries from the figures container. This is achieved by using a property change listener for the docking state of the figure. For this purpose, a figure creation functions is used for setting the listener as well as all other properties of the figure.
Additionally, a short test case is provided.
Alexander Mering (2020). Figures-menu adaption for standalone applications (https://www.mathworks.com/matlabcentral/fileexchange/39026-figures-menu-adaption-for-standalone-applications), MATLAB Central File Exchange. Retrieved .
Instead of DTDocumentBar = javaObjectEDT(figures_frame.getRootPane.getLayeredPane.getComponent(1).getComponent(1).getComponent(0).getComponent(0).getComponent(1).getComponent(0));
one could use the great findjobj:
or for Matlab >=R2012a:
JMenuBar.updateUI shall be added to refresh the menus.
The main praise should go to Yair Altman how showed the route. I just discovered and removed the crashing items.
About the error: I extracted the functions from a larger project and forgot to rename the MousePressed Callback in the Callback_DockingFcn.
I made an update and changed
Cbrake_Callback_Diagrams_DockingFcn -> Callback_DockingFcn
Nice submission . Starting the desktop from a deployead application is amazing!!).
Under R2012b , Windows XP in deployed mode , I get only once this error :
Undefined function or variable 'Cbrake_Callback_Diagrams_DockingFcn'.
Error in Callback_DockingFcn/@(source,event)Cbrake_Callback_Diagrams_DockingFcn
but if works as expected , I mean ... figures can be docked in deployed mode.
Removed an error from the MousePressed_Callback for the DTDocumentBarButtons