Trail: Creating a GUI With JFC/Swing
Lesson: Performing Custom Painting
Solving Common Painting Problems
Home Page > Creating a GUI With JFC/Swing > 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: 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 and Solving Common Layout Problems.

Problems with the examples? Try Compiling and Running the Examples: FAQs.
Complaints? Compliments? Suggestions? Give us your feedback.

Previous page: Summary
Next page: Questions and Exercises: Performing Custom Painting - all specs in one place