Insubstantial / insubstantial

Swing look-and-feel library and assorted widgets
193 stars 57 forks source link

IllegalArgumentException in SubstanceImageCreator.getRadioButton #138

Open enwired opened 9 years ago

enwired commented 9 years ago

This exception has been observed on one occasion when using Substance LAF in our project.

java.lang.IllegalArgumentException: alpha value out of range
    at java.awt.AlphaComposite.<init>(AlphaComposite.java:618)
    at java.awt.AlphaComposite.getInstance(AlphaComposite.java:683)
    at org.pushingpixels.substance.internal.utils.SubstanceImageCreator.getRadioButton(SubstanceImageCreator.java:880)
    at org.pushingpixels.substance.internal.ui.SubstanceRadioButtonUI.getIcon(SubstanceRadioButtonUI.java:206)
    at org.pushingpixels.substance.internal.ui.SubstanceRadioButtonUI.getDefaultIcon(SubstanceRadioButtonUI.java:311)
    at org.pushingpixels.substance.internal.ui.SubstanceRadioButtonUI.paint(SubstanceRadioButtonUI.java:346)
    at javax.swing.plaf.ComponentUI.update(ComponentUI.java:161)
    at org.pushingpixels.substance.internal.ui.SubstanceRadioButtonUI.__org__pushingpixels__substance__internal__ui__SubstanceRadioButtonUI__update(SubstanceRadioButtonUI.java)
    at org.pushingpixels.substance.internal.ui.SubstanceRadioButtonUI.update(SubstanceRadioButtonUI.java)
    at javax.swing.JComponent.paintComponent(JComponent.java:777)
    at javax.swing.JComponent.paint(JComponent.java:1053)
    at javax.swing.JComponent.paintToOffscreen(JComponent.java:5223)
    at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.java:1572)
    at javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1495)
    at javax.swing.RepaintManager.paint(RepaintManager.java:1265)
    at javax.swing.JComponent._paintImmediately(JComponent.java:5171)
IvanRF commented 8 years ago

+1

Regarding your commit, there are more places to check the alpha value on the SubstanceImageCreator class.

enwired commented 7 years ago

Thanks! The single fix that I did in my fork was enough to eliminate the problem in our project, but you may be correct that this problem can occur in other instances.

IvanRF commented 7 years ago

@enwired do you have an scenario for this same issue on https://github.com/kirill-grouchnikov/substance/pull/18? (in order to find the root cause)

enwired commented 7 years ago

Unfortunately I do not have any way to reproduce this. It was seen once or twice in our code, but was not easily reproducible. It has never been seen again after I applied the little fix.