[crossfire] Java Editor

Andreas Vogl andi.vogl at gmx.net
Mon Jun 6 06:52:16 CDT 2005


In reply to Todd Mitchell:
>
     
      The current Java Editor does not seem to be very stable.
     
     >
     
      Especially it tends to have a problem with really big maps
     
     >
     
      (can't open them) and eventually won't open maps and has
     
     >
     
      to be restarted.  Behaves like a Memory leak?
     
     >
     
      Also sometimes the map window graphics are getting corrupted
     
     >
     
      by the file menus from the main window (something updating
     
     >
     
      the wrong container?)
     
     
I don't know about the memory leaks, but I do have an idea what may cause
the graphic corruptions in some places:

In some of the older JREs, it was difficult to force an immediate redraw of
a component. The "Component.repaint()" method, which is supposed to do the
job, sometimes did not do it, because the JRE somehow tried to be smart
about it and postponed the redraw when there was other important stuff to
do.
For that reason I sometimes used the following hack to force a repaint:

// JComponent myComponent;
myComponent.update(myComponent.getGraphics()); // forced redraw, buggy

This leads to drawing glitches in modern JREs, in fact it may have caused
trouble all along. In modern JREs the "Component.repaint()" works perfectly
reliable and should in all cases replace the hack as seen above.
Search for the string ".getGraphics" in the java sources to find the
buggers, and change into:

// JComponent myComponent;
myComponent.repaint(); // forced redraw, safe

Im not 100% sure wether this will make all graphic glitches go away, but at
least some of them probably. It should be done anyways.


Greetings,

AndreasV


-- 
Geschenkt: 3 Monate GMX ProMail gratis + 3 Ausgaben stern gratis
++ Jetzt anmelden & testen ++ 
     
     http://www.gmx.net/de/go/promail
     
      ++

    
    


More information about the crossfire mailing list