Skip to main content

Bug in Linux-Version for swinghelper

5 replies [Last post]
theuserbl
Offline
Joined: 2004-05-04

I have read the blog of
http://weblogs.java.net/blog/alexfromsun/archive/2006/11/advanced_painti...
and there is also mentioned his project-side hat
https://swinghelper.dev.java.net/

There I have tried all the programs on Windows XP and Linux.
On Windows it runs ok, with all JDK-Versions.

But on Linux with the JDK build 1.6.0-rc-b103 it have problems (Don't know, if the bugs are since that time fixed).

In the InternalFrame Demo selecting "Set painters and alpha" works fine on Linux.
But selecting "Apply InvertBufferedImageOp" works also, but needs very long and handling the internal windows is very very slow.
And selecting "Apply GrayScaleImageOp" hangs up with the following error message:

patrick@hostname:~/uzzz/java/z> java -version
java version "1.6.0-rc"
Java(TM) SE Runtime Environment (build 1.6.0-rc-b103)
Java HotSpot(TM) Client VM (build 1.6.0-rc-b103, mixed mode, sharing)
patrick@hostname:~/uzzz/java/z> java -cp layer.jar:layer-demo.jar org.jdesktop.swinghelper.layer.demo.InternalFrameDemo
Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: sun.awt.image.WritableRasterNative cannot be cast to sun.awt.image.IntegerComponentRaster
at sun.awt.color.CMMImageLayout.(CMMImageLayout.java:185)
at sun.awt.color.ICC_Transform.getImageLayout(ICC_Transform.java:339)
at sun.awt.color.ICC_Transform.colorConvert(ICC_Transform.java:161)
at java.awt.image.ColorConvertOp.ICCBIFilter(ColorConvertOp.java:335)
at java.awt.image.ColorConvertOp.filter(ColorConvertOp.java:262)
at org.jdesktop.swinghelper.layer.JXLayer.paint(JXLayer.java:291)
at javax.swing.JComponent.paintChildren(JComponent.java:859)
at javax.swing.JComponent.paint(JComponent.java:1031)
at javax.swing.JLayeredPane.paint(JLayeredPane.java:564)
at javax.swing.JComponent.paintChildren(JComponent.java:859)
at javax.swing.JComponent.paint(JComponent.java:1031)
at javax.swing.JComponent.paintToOffscreen(JComponent.java:5104)
at javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:285)
at javax.swing.RepaintManager.paint(RepaintManager.java:1132)
at javax.swing.JComponent._paintImmediately(JComponent.java:5052)
at javax.swing.JComponent.paintImmediately(JComponent.java:4862)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:727)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:683)
at javax.swing.RepaintManager.seqPaintDirtyRegions(RepaintManager.java:663)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:128)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
patrick@hostname:~/uzzz/java/z>

If I click in the GlassPaneDemo on " "Disable" the little button", then it gives on Linux the following out:

patrick@hostname:~/uzzz/java/z> java -cp layer.jar:layer-demo.jar org.jdesktop.swinghelper.layer.demo.GlassPaneDemo
Exception in thread "AWT-EventQueue-0" java.awt.image.ImagingOpException: Unable to convolve src image
at java.awt.image.ConvolveOp.filter(ConvolveOp.java:180)
at org.jdesktop.swinghelper.layer.JXLayer.paint(JXLayer.java:289)
at javax.swing.JComponent.paintToOffscreen(JComponent.java:5104)
at javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:285)
at javax.swing.RepaintManager.paint(RepaintManager.java:1132)
at javax.swing.JComponent._paintImmediately(JComponent.java:5052)
at javax.swing.JComponent.paintImmediately(JComponent.java:4862)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:727)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:683)
at javax.swing.RepaintManager.seqPaintDirtyRegions(RepaintManager.java:663)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:128)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
patrick@hostname:~/uzzz/java/z>

And if I click in the GlassPaneDemo on "Show me more with a GlasPane!", then it gives out the follwoing error.

patrick@hostname:~/uzzz/java/z> java -cp layer.jar:layer-demo.jar org.jdesktop.swinghelper.layer.demo.GlassPaneDemo
Exception occurred during event dispatching:
java.awt.image.ImagingOpException: Unable to convolve src image
at java.awt.image.ConvolveOp.filter(ConvolveOp.java:180)
at org.jdesktop.swinghelper.layer.JXLayer.paint(JXLayer.java:289)
at javax.swing.JComponent.paintToOffscreen(JComponent.java:5104)
at javax.swing.BufferStrategyPaintManager.paint(BufferStrategyPaintManager.java:285)
at javax.swing.RepaintManager.paint(RepaintManager.java:1132)
at javax.swing.JComponent._paintImmediately(JComponent.java:5052)
at javax.swing.JComponent.paintImmediately(JComponent.java:4862)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:727)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:683)
at javax.swing.RepaintManager.seqPaintDirtyRegions(RepaintManager.java:663)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:128)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:177)
at java.awt.Dialog$1.run(Dialog.java:1039)
at java.awt.Dialog$3.run(Dialog.java:1091)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Dialog.show(Dialog.java:1089)
at javax.swing.JOptionPane.showOptionDialog(JOptionPane.java:853)
at javax.swing.JOptionPane.showConfirmDialog(JOptionPane.java:779)
at javax.swing.JOptionPane.showConfirmDialog(JOptionPane.java:741)
at javax.swing.JOptionPane.showConfirmDialog(JOptionPane.java:702)
at org.jdesktop.swinghelper.layer.demo.GlassPaneDemo$1$1.run(GlassPaneDemo.java:34)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
patrick@hostname:~/uzzz/java/z>

In both cases it gives only the error out without having the GlassEffect.

It seems, that there are more things in Java are implemented in native-code, then I have thought before. Otherwise the platform would be not have a so big importance.

Greatings
theuserbl

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
trembovetski
Offline
Joined: 2003-12-31

I suspect that these issues will go away if you run with -Dsun.java2d.pmoffscreen=false .

We're working on a fix (for jdk7) which will address this as a side effect.

In the meantime, there's a simple work around in the code that swinghelper could use to avoid this.

And yes, out of the whole set of libraries, Java2D has the most native code.

Thanks,
Dmitri

theuserbl
Offline
Joined: 2004-05-04

> [i]I suspect that these issues will go away if you run with -Dsun.java2d.pmoffscreen=false .[/i]

I have now tested it on Linux. You are right, with this flag it runs without problems on Linux. :-).

I only wonder, why this setting isn't the default.

Greatings
theuserbl

trembovetski
Offline
Joined: 2003-12-31

> I only wonder, why this setting isn't the default.

Simple: because this flag makes most swing applications
much, much slower on X11 (especially with remote X server).

Dmitri

alexfromsun
Offline
Joined: 2005-09-05

Hello theuserbl

I just came across this thread

Thank you for using JXLayer!

I didn't know about that problems under Linux,
and eager to know the "simple workaround" from Dmitri
:-)

Dmitri can you give a hint how I can fix it ?

Thanks

If you have any more comments about JXLayer,
please post them for one of my latest blogs
this will help me to be informed

Thanks again
alexp

alexfromsun
Offline
Joined: 2005-09-05

The problem is fixed,
JXLayer works well both on Windows and Unux family OS

Thanks for your report !

alexp