필터 지우기
필터 지우기

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

조회 수: 11 (최근 30일)
Tenzin Kunkyab
Tenzin Kunkyab 2021년 8월 10일
편집: Himanshu 2024년 6월 6일
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

답변 (1개)

Himanshu
Himanshu 2024년 6월 6일
편집: Himanshu 2024년 6월 6일
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!

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by