java.awt.I​llegalComp​onentState​Exception: The frame is decorated

11 visualizaciones (últimos 30 días)
Tenzin Kunkyab
Tenzin Kunkyab el 10 de Ag. de 2021
Editada: Himanshu el 6 de Jun. de 2024
Hi,
I got the following error from an old code that I am trying to fix to work in modern version of matlab: (If there is an easy way to fix the bug, would be really helpful!)
Java exception occurred:
java.awt.IllegalComponentStateException: The frame is decorated
at java.awt.Frame.setOpacity(Frame.java:960)
at java.awt.Window$1.setOpacity(Window.java:4037)
at com.sun.awt.AWTUtilities.setWindowOpacity(AWTUtilities.java:174)
The original code is the following:
for stepIdx = 1 : 10
if stepIdx == 1
com.sun.awt.AWTUtilities.setWindowOpacity(jWindow1,0.01)
pause(0.25)
end
newAlpha = -.01 + 0.1*stepIdx;
com.sun.awt.AWTUtilities.setWindowOpacity(jWindow1,newAlpha)
jWindow1.repaint;
end

Respuestas (1)

Himanshu
Himanshu el 6 de Jun. de 2024
Editada: Himanshu el 6 de Jun. de 2024
Hi Tenzin,
I understand that you are trying to set the opacity of a java frame but are encountering an error. The error message indicates that the 'frame is decorated', which is precisely the issue.
Newer versions of Java (and hence MATLAB) do not allow setting the opacity of a window to less than 0.1f if it is decorated. There are also some other constraints deatils of which can be found here: https://docs.oracle.com/javase/7/docs/api/java/awt/Frame.html#setOpacity%28float%29
Hope this information helps!

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by