Meet the Java error "java.awt.IllegalComponentStateException" in MATLAB

I'm newer here.

I very often get java error when using MATLAB. I am using an Intel Mac and the MATLAB version is R2012a.

The error is displayed in the MATLAB command window as follows:

java.awt.IllegalComponentStateException: component must be showing on the screen to determine its location at java.awt.Component.getLocationOnScreen_NoTreeLock(Component.java:1971) at java.awt.Component.getLocationOnScreen(Component.java:1945) at apple.awt.CAccessibility$22.call(CAccessibility.java:370) at apple.awt.CAccessibility$22.call(CAccessibility.java:368) at apple.awt.CToolkit$CallableWrapper.run(CToolkit.java:1121) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199) at apple.awt.CToolkit$CPeerEvent.dispatch(CToolkit.java:1211) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:702) at java.awt.EventQueue.access$400(EventQueue.java:82) at java.awt.EventQueue$2.run(EventQueue.java:663) at java.awt.EventQueue$2.run(EventQueue.java:661) at java.security.AccessController.doPrivileged(Native Method) at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87) at java.awt.EventQueue.dispatchEvent(EventQueue.java:672) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188) at java.awt.EventDispatchThread.run(EventDispatchThread.java:122) 

As I know, this error only happens when I do something with the mouse.

eg.

When I right-click the MATLAB function in the current folder, click Open. I will get an 80% chance of getting this error. But if you just enter edit xxx.m in the command window. then I will never get this error.

When I drag a variable from Workspace to the Variable Editor, I have an 80% chance of getting this error. And I do not consider a variable in the Variable Editor with the command.

And, if this error occurred, it will happen all the time until you turn off your MATLAB and restart it if you do something with the mouse. for example, add the path to the MATLAB search path with the mouse, change the directory with the mouse. If you open it again, you will again get an 80% chance of getting this problem when using the mouse.

Has anyone else seen such problems? I don't know anything about java. Can someone give me some suggestion. Thanks.

+4
source share
2 answers

I can’t talk about this particular error, but such errors are quite common in Matlab. This is due to a bug in the Matlab GUI (which is written in Java). In this case, it looks like he tried to open the "Open File" dialog box, which is Mac-specific, and failed, and then tried to get the position of this dialog box that triggered the error because it was never open correctly. As Java throws an error, the GUI confuses everything and throws errors into everything that you do.

You seem to know how to handle yourself, but here is a general tip that I give to those who have such errors: these error messages look awful on your screen, especially when they continue to appear with every click after launching the first one, but Do not panic, they are usually completely harmless. Safely save your workspace from the GUI, which usually works, or with the save temp.mat , which almost always works. Close Matlab after saving the workspace, then start Matlab again and load the workspace, either from the graphical user interface or using the load temp.mat . Your Matlab session is now back and you have not lost any data.

+2
source

This issue was previously reported by people using MATLAB version R2012a on MAC

Try using a different version. Else file reports an error in TMW.

+1
source

Source: https://habr.com/ru/post/1440004/


All Articles