Effacer les filtres
Effacer les filtres

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

11 vues (au cours des 30 derniers jours)
Tenzin Kunkyab
Tenzin Kunkyab le 10 Août 2021
Modifié(e) : Himanshu le 6 Juin 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

Réponses (1)

Himanshu
Himanshu le 6 Juin 2024
Modifié(e) : Himanshu le 6 Juin 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!

Catégories

En savoir plus sur Startup and Shutdown dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by