File Exchange

image thumbnail

Figures-menu adaption for standalone applications

version (5.76 KB) by Alexander Mering
Create dockable figures for standalones and disable or remove menu items from the figures container

1 Download

Updated 15 Nov 2012

View License

As pointed out by Yair Altman in his very popular blog (, 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.

Cite As

Alexander Mering (2020). Figures-menu adaption for standalone applications (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (3)

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.

Thanks Aurelien.
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

MATLAB Release Compatibility
Created with R2011b
Compatible with any release
Platform Compatibility
Windows macOS Linux