Much time wasted on fighting the Layout Manager in order to get all the damn JLabels and JPanels positioned properly. I hate fighting the language – I have to figure out the intent of the designer, which is usually inscrutable. So I abandoned Swing and instead tried to do it directly in a Graphics system, drawing rectangles and such. It doesn’t work, either – apparently embedding Graphics stuff inside a JPanel irritates Java. Worse, the damn thing keeps re-calling the paint routine, and I can’t figure out why it does so repeatedly. I tried working with the validation, but apparently there’s no way to say “Stop validating!” or “valid = true” or any such thing. Grr.
My next attempt will be to see if I can’t go back to JLabels but muzzle the Layout Manager.
It works — after a fashion. I muzzled the Layout Manager by setting its value for the crucial component to “null”, meaning that that particular component had no automatic layout of its components. I had to explicitly calculate and declare the position of each of the seven components inside. That was easy. But getting the damn thing to display properly took all manner of hair-rending and teeth-gnashing. Ever wondered why I have so little hair? Here’s what the thing looks like just now:
It needs a little touch-up, such as a black boundary. It does operate properly: if you slide one of the thumbs, the adjacent colored rectangles automatically and correctly expand and contract. However, I still have to get the value at the top of the page updated as you move the thumb. And the real problem still lurks inside its cave: for some reason the thing refuses to display when it first appears. If you jump to another page and then back, it’s fine, but it doesn’t initialize so well. Hooray for Java...
Got it all working, by dint of bull-headed stubbornness rather than any great intelligence. I didn’t defeat Java — I simply wore it down to the point where it just couldn’t stop me. I suppose it’s time for bed.