When using Java objects in MATLAB, you set callbacks for the objects that correspond to the Listeners you would associate with the objects in Java code.
JF = JFrame;
JB = JButton('Press me');
set(JB,'MouseClickedCallback','disp(''pressed the button'')')
The callbacks can be:
1) A string that will be executed as a MATLAB command in the base workspace
2) A function handle where the inputs to the function will always be the handle for the object, and event data, respectively.
3) A cell array where the first element is a function name or function handle. The first two inputs to the function are automatically the handle for the Java object, and an Event object. The other elements of the cell array are passed as the third, fourth, etc. inputs to the function.
Please note that listeners can only be created for classes accessible through the main Java search path defined by classpath.txt.