Previous | Next | Trail Map | Creating a GUI with JFC/Swing | Working with Graphics

Solving Common Graphics 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? If you don't see your problem in this list, see Solving Common Component Problems(in the Creating a User Interface trail) and Solving Common Layout Problems(in the Creating a User Interface trail).


Previous | Next | Trail Map | Creating a GUI with JFC/Swing | Working with Graphics