The JavaTM Tutorial
Previous Page Lesson Contents Next Page Start of Tutorial > Start of Trail > Start of Lesson Search
Feedback Form

Trail: Creating a GUI with JFC/Swing
Lesson: Performing Custom Painting

Solving Common Painting Problems

Problem: I don't know where to put my painting code. Problem: The stuff I paint doesn't show up. Problem: The background of my applet shows up, but the foreground stuff doesn't show up. Problem: My component's foreground shows up, but its background is invisible. The result is that one or more components directly behind my component are unexpectedly visible.

Problem: I used setBackground to set my component's background color, but it seemed to have no effect.

Problem: I'm using the exact same code as a tutorial example, but it doesn't work. Why?

Problem: How do I paint thick lines? patterns? Problem: The edges of a particular component look odd. Problem: Visual artifacts appear in my GUI. Problem: The performance of my custom painting code is poor. Problem: The same transforms applied to seemingly identical Graphics objects sometimes have slightly different effects.

If you don't see your problem in this list, see Solving Common Component Problems (in the Creating a GUI with JFC/Swing trail) and Solving Common Layout Problems (in the Creating a GUI with JFC/Swing trail).


Previous Page Lesson Contents Next Page Start of Tutorial > Start of Trail > Start of Lesson Search
Feedback Form

Copyright 1995-2005 Sun Microsystems, Inc. All rights reserved.