Filter löschen
Filter löschen

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

11 Ansichten (letzte 30 Tage)
Tenzin Kunkyab
Tenzin Kunkyab am 10 Aug. 2021
Bearbeitet: Himanshu am 6 Jun. 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

Antworten (1)

Himanshu
Himanshu am 6 Jun. 2024
Bearbeitet: Himanshu am 6 Jun. 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!

Kategorien

Mehr zu Startup and Shutdown finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by