Download the JDK
Search the Tutorials
Hide the TOC
Performing Custom Painting
How Swing Components Are Displayed
Introduction to Painting Concepts
Implementing a Custom Component
Summary
Solving Common Painting Problems
Trail: Creating a GUI with JFC/Swing
« Previous • Trail • Next »

Examples Index

Lesson: Performing Custom Painting

> > This section has not yet been updated to reflect features and conventions of the latest release, JDK 6.0.

> You might not need to read this lesson at all. Many programs get by with no custom painting. If they display images, they do so using icons in standard Swing components such as labels and buttons. To display styled text, perhaps with embedded images and components, they use text components. To customize the edges of components, they use borders. To change the look of all components, they use a customizable look and feel, such as the GTK+ look and feel.

> If you can't find a way to make a component look the way you want it to, then read on. This lesson introduces painting concepts, as they apply to Swing components, and then refers you elsewhere so you can write painting code that makes your custom components look great.

### How Swing Components Are Displayed

> Describes how painting happens, with special attention to the framework provided by `JComponent`.

### Introduction to Painting Concepts

> Gives an overview of the coordinate system, including how borders affect it, and discusses the `Graphics` and `Graphics2D` classes.

### Implementing a Custom Component

> Tells how to implement painting code within a Swing component using the `paintComponent` method.

### Summary

> Summarizes this lesson and points to where you can find out more.

### Solving Common Painting Problems

> Describes some common problems related to painting, along with possible solutions to these problems.

### Questions and Exercises

> Try these questions and exercises to test what you've learned in this lesson.

« Previous • Trail • Next »
Previous page: Previous Lesson
Next page: How Swing Components Are Displayed