My code is a GUI with several Java-based user interfaces (JIDE components, java and jTable user classes).
Here is a snippet of my code:
%% 1st Table. %Loading my custom java class ParameterTableModel (extends DefaultTableModel) % ... %% 2nd Table - Building JIDE property table PropertyTableList = java.util.ArrayList(); % Creating 1st property MyProp = javaObjectEDT(com.jidesoft.grid.DefaultProperty()); MyProp.setName('TypeOfAnalysis'); set(handle(MyProp,'CallbackProperties'),'PropertyChangeCallback',{@PropCB}); PropertyTableList.add(MyProp); % Building table PropertyTableModel = javaObjectEDT(com.jidesoft.grid.PropertyTableModel(PropertyTableList)); PropertyTableGrid = javaObjectEDT(com.jidesoft.grid.PropertyTable(PropertyTableModel)); PropertyPane = javaObjectEDT(com.jidesoft.grid.PropertyPane(PropertyTableGrid)); [~, mhPropertyPane] =javacomponent(PropertyPane,[0,0,1,1], figure ); set(mhPropertyPane,'Units','normalized','Position',[0,0,1,1]) % fake callback, property changed function PropCB( hobj, hev ) disp('PropCB') end
When I close the main shape and call "clear java" in the command window, this warning is issued:
Warning: objects of class ParameterTableModel exist - not java clearing
If I have not connected the MyProp callback, a warning is no longer issued. The only workaround I found is to call:
set(MyProp.handle('CallbackProperties'),'PropertyChangeCallback',[])
in the CloseRequestFcn drawing. But this is unsatisfactory, as I have hundreds of such properties in my full graphical interface.
I found this question related to my problem, but no real answer: clear Java memory