August 4th

Once again I find myself at loggerheads with Java. Actually, it’s Swing that drives me nuts; Java’s system for permitting cleanly resizable windows is great and wonderful, except for the fact that it seldom works properly. Herewith some of today’s harrowing experiences:


Setting Maximum Size

I’ve been having problems with portions of the display being way too large. I have struggled against this by use of the SetMaximumSize method in the JComponent class. This works about as well as sprinkling holy water on Godzilla. Perhaps subcomponents of the display were oversize, therefore busting out of the maximum size limit, invalidating all maximum sizes. OK, so I went through every single visible component of the display and set its maximum size to insure that nothing would get too large. No luck. I kept fooling around until (and this will give you an idea of how desperate I was) I used the SetMinimumSize method. Lo and behold, setting the Minimum Size actually sets the Maximum size. How utterly clever of the Java designers!

Alignment

In the Java tutorial on BoxLayouts, it warns that the most common problem with getting visual components laid out properly is the failure to set the alignment of the components. So I set to work, assigning alignment values to every single component. I set them all to align along the top and left edges of the container. Once again, I felt like I was wielding a peashooter against Godzilla. It was only when I removed every last reference to alignments that it started working more like it should have worked. I’m beginning to get the feel of Java: everything is backwards. I wonder if I read some of the documents backwards, will I find the message “Paul is dead”?

Zombie imagery

Please to observe this screen shot:


Note the oddity along the left edge. That is the right edge of a photograph that appears in the screen display for the player’s final score. The screen drawing routines make no reference whatsoever to this image; moreover, it’s the wrong image for Food Production. I could halfway understand if the right edge of the “Food Production” image were somehow showing up on the screen, but this is an ancient relic from a long-dismissed page. What in the world is it doing here?

I checked and sure enough, there’s a call to removeAll() in the screen drawing routine; the JPanel that holds that image has had everything removed. Yet, somehow this zombie image refuses to die. Who knows where it came from? Who knows where it will show up? Perhaps it has infected my computer, and fragments of this image will be popping up while I’m writing email or surfing the Net. For that matter, how do we know it hasn’t already infected the Internet, and pretty soon you’llyour be seeing it at random locations on screen?

Who knows what evil lurks in the heart of Java? The Shadow knows!