This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Some observations about your code: 1 - JApplet extends from Applet which extends Panel. The default layout manager for Panel is FlowLayout. So the content pane of a JApplet is (by default) FlowLayout. You can change it to another layout to suit your purposes.
2 - in Swing (any component with "J" prefix) we usually override the paintComponent method. Overriding paint, which is a Container method and is called to paint a container's components, will paint over all components. It's okay to do but it takes some care.
3 - calling super.paintComponent in the paintComponent method will tell Swing to paint the background which will prevent artifacts in your component. If you do decide to override paint in lieu of paintComponent you can call super.paint.
4 - the Graphics2D class allows for more fancy affects in drawing and the RenderingHint makes smooth (anti–aliased) lines.
[ May 29, 2004: Message edited by: Craig Wood ] [ May 29, 2004: Message edited by: Craig Wood ]