フィルターのクリア

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 Center および File ExchangeStartup and Shutdown についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by