-
Bug
-
Resolution: Not an Issue
-
P2
-
None
-
1.4.0
-
sparc
-
solaris_8
I am using the JTopLevel class provided by Michael Martak to manage
some Swing components in the offscreen environment, so that they paint
into a BufferedImage.
On building a component tree and calling JTopLevel.pack()/show() I get
the following difference in behavior between headless & non-headless.
In non-headless mode it work fine and creates the expected image.
But in headless mode, HeadlessException is thrown.
===========================
dherron@tokyojoe:/home/dherron/work/headless/hp2( 77 )% java -classpath headless.jar headless.swingt.Main headless.swing.SimpleExample img 500 500
Warning: Cannot convert string "-monotype-arial-regular-r-normal--*-140-*-*-p-*-iso8859-1" to type FontStruct
dherron@tokyojoe:/home/dherron/work/headless/hp2( 78 )% java -Djava.awt.headless=true -classpath headless.jar headless.swingt.Main headless.swing.SimpleExample img 500 500
Exception in thread "main" java.awt.HeadlessException
at sun.awt.HeadlessToolkit.getScreenSize(HeadlessToolkit.java:253)
at javax.swing.RepaintManager.getDoubleBufferMaximumSize(RepaintManager.java:630)
at javax.swing.RepaintManager._getOffscreenBuffer(RepaintManager.java:537)
at javax.swing.RepaintManager.getVolatileOffscreenBuffer(RepaintManager.java:532)
at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4371)
at javax.swing.JComponent.paint(JComponent.java:685)
at javax.swing.JComponent.paintChildren(JComponent.java:542)
at headless.swingt.JTopLevel.redraw(JTopLevel.java:194)
at headless.swingt.JTopLevel.show(JTopLevel.java:203)
at headless.swingt.JTopLevel.pack(JTopLevel.java:212)
at headless.swingt.Main.main(Main.java:115)
============================
Examining this a bit, obviously Toolkit.getScreenSize() doesn't make sense in
headless mode. On the other hand, this is clearly an offscreen buffer and
the calls in javax.swing.RepaintManager are to "OffscreenBuffer" methods.
JTopLevel is intended to be used in the headless environment to provide
enough framework to allow lightweight components to paint.
Source code is in the attachment or at /home/dherron/work/headless/bug-swing-paint.tar.gz
Run as follows
% mkdir build
% make
% sh ./run.sh
some Swing components in the offscreen environment, so that they paint
into a BufferedImage.
On building a component tree and calling JTopLevel.pack()/show() I get
the following difference in behavior between headless & non-headless.
In non-headless mode it work fine and creates the expected image.
But in headless mode, HeadlessException is thrown.
===========================
dherron@tokyojoe:/home/dherron/work/headless/hp2( 77 )% java -classpath headless.jar headless.swingt.Main headless.swing.SimpleExample img 500 500
Warning: Cannot convert string "-monotype-arial-regular-r-normal--*-140-*-*-p-*-iso8859-1" to type FontStruct
dherron@tokyojoe:/home/dherron/work/headless/hp2( 78 )% java -Djava.awt.headless=true -classpath headless.jar headless.swingt.Main headless.swing.SimpleExample img 500 500
Exception in thread "main" java.awt.HeadlessException
at sun.awt.HeadlessToolkit.getScreenSize(HeadlessToolkit.java:253)
at javax.swing.RepaintManager.getDoubleBufferMaximumSize(RepaintManager.java:630)
at javax.swing.RepaintManager._getOffscreenBuffer(RepaintManager.java:537)
at javax.swing.RepaintManager.getVolatileOffscreenBuffer(RepaintManager.java:532)
at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4371)
at javax.swing.JComponent.paint(JComponent.java:685)
at javax.swing.JComponent.paintChildren(JComponent.java:542)
at headless.swingt.JTopLevel.redraw(JTopLevel.java:194)
at headless.swingt.JTopLevel.show(JTopLevel.java:203)
at headless.swingt.JTopLevel.pack(JTopLevel.java:212)
at headless.swingt.Main.main(Main.java:115)
============================
Examining this a bit, obviously Toolkit.getScreenSize() doesn't make sense in
headless mode. On the other hand, this is clearly an offscreen buffer and
the calls in javax.swing.RepaintManager are to "OffscreenBuffer" methods.
JTopLevel is intended to be used in the headless environment to provide
enough framework to allow lightweight components to paint.
Source code is in the attachment or at /home/dherron/work/headless/bug-swing-paint.tar.gz
Run as follows
% mkdir build
% make
% sh ./run.sh
- relates to
-
JDK-4407300 Undocumented HeadlessException from double-buffered Component.paint
-
- Closed
-