The very first thing I noticed is that RectangleCanvas extends Canvas. This is an AWT component, and you are using Swing components in other places. This causes no end of problems, but is easy to fix. Instead of subclassing Canvas, just subclass JPanel, and change paint(Graphics) to paintComponent(Graphics).
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
posted 16 years ago
Thanks, but the rectangles still don't seem to be displaying
RectanglesCanvas.paintComponent draws the Rectangle it finds in the member variable "rect" of the enclosing class. But I don't see where this variable is ever initialzed -- i.e., it's null, so there's nothing to draw. Actually, you ought to be getting stack traces because of this.
So, looking back through this thread, I don't see where you actually told us what the problem is we're trying to solve. Does this compile? Does it run but crash? Does it run but do nothing? Do some tabs work, but not others? How about if you just stuff the RectanglesApplet into a JFrame, without the JTabbedPane and all the other stuff. Does it show up? What do you see?