Home arrow static arrow Java Programming [Archive] - Repainting problem
Warning: Creating default object from empty value in /www/htdocs/w008deb8/wiki/components/com_staticxt/staticxt.php on line 51
Java Programming [Archive] - Repainting problem
This topic has 1 reply on 1 page.

Posts:2,206
Registered: 8/15/02
Repainting problem  
Jul 15, 2004 6:15 PM



 
I have encountered a strange and spooky problem, and I am completely stuck. I am displaying things in a JTree and have my own TreeCellRenderer. This all works fine, but now I want to modify the renderer to display the associated text in red if a certain condition occurs. So I make a call to check the condition. In most cases this works, and if the condition is met, lo and beold the text appears red. EXCEPT for one particular item associated with the JTree. As soon as I put in one of these items in the JTree, the Repaint manager goes into la-la land and gets called continuously, screwing up the display of the JTree components and setting itself off into an infinite loop. To make sure it is the call to check the condition that is the cause, I have removed the setForeground() (i.e. do nothing that could fire a repaint), but I still hit the problem.

Sorry about the crappy description, but it is really complex to explain.

Is there any way to find out what has triggered a repaint event, so I can see why the frig the system has gotten into this state? I have chucked in a printStacktrace in the infinite loop, and this is the result (my call to check the condition is getElapsedTime in OtTreeCellRenderer.java...

java.lang.Exception
at orac.ukirt.iter.SpIterCGS4CalObsEnumeration.<init>(SpIterCGS4CalObs.java:44)
at orac.ukirt.iter.SpIterCGS4CalObs.elements(SpIterCGS4CalObs.java:223)
at gemini.sp.iter.SpIterFolder.compile(SpIterFolder.java:64)
at gemini.sp.iter.SpIterFolder.getElapsedTime(SpIterFolder.java:135)
at gemini.sp.SpObs.getElapsedTime(SpObs.java:367)
at gemini.sp.SpMSB.getElapsedTime(SpMSB.java:293)
at jsky.app.ot.OtTreeWidget.getTreeCellRendererComponent(OtTreeWidget.java:1014)
at javax.swing.plaf.basic.BasicTreeUI.paintRow(BasicTreeUI.java:1375)
at javax.swing.plaf.basic.BasicTreeUI.paint(BasicTreeUI.java:1171)
at javax.swing.plaf.metal.MetalTreeUI.paint(MetalTreeUI.java:152)
at javax.swing.plaf.ComponentUI.update(ComponentUI.java:142)
at javax.swing.JComponent.paintComponent(JComponent.java:541)
at javax.swing.JComponent.paint(JComponent.java:808)
at javax.swing.JComponent.paintWithOffscreenBuffer(JComponent.java:4787)
at javax.swing.JComponent.paintDoubleBuffered(JComponent.java:4740)
at javax.swing.JComponent._paintImmediately(JComponent.java:4685)
at javax.swing.JComponent.paintImmediately(JComponent.java:4488)
at javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:410)
at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(SystemEventQueueUtilities.java:117)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:178)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:454)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
 

Posts:1,695
Registered: 1/13/04
Re: Repainting problem  
Jul 16, 2004 12:16 AM (reply 1 of 1)



 
First of all, you should post some code...
 
This topic has 1 reply on 1 page.