Hi,
My first post of many.

I have a little problem let me tell you:

Setting the scene.

I have has this problem occurring with an application that I am developing. It appears to occur on some machines more than others and seems independent of processor speeds, memory e.t.c.

What I have is a JPanel (workspace panel), within this is contained other JPanels (component panels).

These component panels contain various symbols and text drawn via JavaGraphics2D.

The component tiles are all of equal size and arranged in a gird like formation with the gridbag layout. All component panels and the workspace panel have double buffering turned on.

These tiles can then build up an image i.e. a flow chart. Each tile contains a mouse listener so that its is highlighted when the mouse is over the component and de-highlighted when it is removed.


However, occasionally the program tends to crash. Sometimes this happens when a another component such as a JDialog obscures part of the workspace panel. However less frequently it can happen when the graphics of the workspace panel are updating. For example during highlighting or adding component panels.


The crash comes in a variety of form but seems to relate to the Text rendering of Java2D. It causes the program to freeze. This problem never occurred before I migrated to Java2D from the standard Java Graphics package. The two most recent variants of the exception stack dumps are shown below.


Exception Stack Dumps:

ONE:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at sun.java2d.loops.DrawGlyphList.DrawGlyphList(Native Method)
at sun.java2d.pipe.SolidTextRenderer.drawGlyphList(SolidTextRenderer.java:36)
at sun.java2d.pipe.GlyphListPipe.drawString(GlyphListPipe.java:53)
at sun.java2d.SunGraphics2D.drawString(SunGraphics2D.java:2642)
at GPTool.IfGraphic.paint(IfGraphic.java:223)
at javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4963)
at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4916)
at javax.swing.JComponent._paintImmediately(JComponent.java:4859)
at javax.swing.JComponent.paintImmediately(JComponent.java:4666)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:451)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.j ava:114)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:158)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)


TWO

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at sun.font.FileFont.getGlyphImage(Native Method)
at sun.font.FileFontStrike.getSlot0GlyphImagePtrs(FileFontStrike.java:388)
at sun.font.CompositeStrike.getGlyphImagePtrs(CompositeStrike.java:97)
at sun.font.GlyphList.mapChars(GlyphList.java:211)
at sun.font.GlyphList.setFromString(GlyphList.java:186)
at sun.java2d.pipe.GlyphListPipe.drawString(GlyphListPipe.java:52)
at sun.java2d.SunGraphics2D.drawString(SunGraphics2D.java:2642)
at GPTool.AssignGraphic.paint(AssignGraphic.java:93)
at javax.swing.JComponent.paintChildren(JComponent.java:842)
at javax.swing.JComponent.paint(JComponent.java:1014)
at javax.swing.JComponent.paintChildren(JComponent.java:842)
at javax.swing.JComponent.paint(JComponent.java:1014)
at javax.swing.JComponent.paintChildren(JComponent.java:842)
at javax.swing.JComponent.paint(JComponent.java:1014)
at javax.swing.JViewport.paint(JViewport.java:728)
at javax.swing.JComponent.paintChildren(JComponent.java:842)
at javax.swing.JComponent.paint(JComponent.java:1014)
at javax.swing.JComponent.paintChildren(JComponent.java:842)
at javax.swing.JComponent.paint(JComponent.java:1014)
at javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4963)
at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4916)
at javax.swing.JComponent._paintImmediately(JComponent.java:4859)
at javax.swing.JComponent.paintImmediately(JComponent.java:4666)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:451)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.j ava:114)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:461)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:158)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

I have taken many a look on the forums around the internet but never found one the specifically answers this problem… Please help


Thanks in advance....

Andrew.