Nasty AWT problem with Java 1.4.1

davidbrit2

Licensed Computer Geek
This is really pissing me off.

I've got a little Java application that uses AWT for its rendering. The main portion of the window is a Panel subclass that draws on its own Graphics object as necessary, sometimes directly, and sometimes by going through a secondary Graphics object that's used as a buffer. The Panel's paint() and repaint() methods simply take the Graphics buffer and splash it over the live Graphics of the Panel. This worked perfectly with 1.3.whatever. Now, with 1.4.1, I can make the Panel render itself correctly via the redrawing button, but when I use one of the popup menus, a good portion of the Panel gets wiped out with the Panel's background color. What in blazes is going on? What step am I missing to prevent this lunacy? That's the one big thing I liked about AWT in comparison to Cocoa/Quartz: none of that messing with NSRects, unexpected partial repaints, and freakishly unpredictable results...

Additional problems:
Drawing directly to the Graphics object that's extracted with getGraphics no longer produces real time updates. Also, the OS X runtime doesn't support traceMethodCalls(true) or traceInstructions(true) which makes this whole situation completely undebuggable. Great.
 
Hey there,

Haven't had a chance to try out what you described, but I'm going to guess here: I read that Apple has now based the AWT underpinnings on Cocoa - this *could* mean that you'll have the same problems with NSRect, etc. in Java/AWT now.
But like I say, this is a fairly unfounded guess :)

C
 
I think that's probably a pretty fair guess. I know they redid everything to run through Quartz, so that's likely the main reason.
 
Back
Top