# Substance look and feel - decoration painters

### Overview

The base class for Substance decoration painters is `org.jvnet.substance.painter.decoration.SubstanceDecorationPainter`. Decoration painter is used to paint "special" (or decoration) areas of frames and dialogs. This allows providing a consistent and pluggable appearance to those areas. In addition, it provides an external API for applications that wish to skin custom components in a visually consistent manner.

### Decoration areas

The `org.jvnet.substance.painter.decoration.DecorationAreaType` enum provides enumeration of available decoration area types. As a picture is worth a thousand words, the following screenshots illustrate the different decoration area types.

The following screenshot is the main Substance test application under the Business Black Steel skin (click to see full size version):

The next screenshot shows the `title` decoration area, which in this example includes the title pane of the main window:

The next screenshot shows the `header` decoration area, which in this example includes the menu bar of the main window:

The next screenshot shows the `toolbar` decoration area, which in this example includes the tool bar of the main window:

The next screenshot shows the `footer` decoration area, which in this example includes the status bar component from the SwingX suite:

The next screenshot shows the `general` decoration area, which in this example includes the task pane container component from the SwingX suite:

Let's go back to the original screenshot:

It illustrates that the specific skin assigns different color schemes to different decoration areas. The controls in those areas get the background and foreground colors based on their assigned color scheme (without any custom application code), thus creating visual distinction between different application areas.

### Painting API

The only painting method in `org.jvnet.substance.painter.decoration.SubstanceDecorationPainter` is

`/**
* Paints the decoration area.
*
* @param graphics
* Graphics context.
* @param comp
* Component.
* @param decorationAreaType
* Decoration area type. Must not be <code>null</code>.
* @param width
* Width.
* @param height
* Height.
* @param theme
* Theme for painting the decoration area.
*/
public void paintDecorationArea(Graphics2D graphics, Component comp,
DecorationAreaType decorationAreaType, int width, int height,
SubstanceTheme theme)`

The `width` and `height` parameters specify the rectangle to highlight (the highlight painters are only used on rectangular areas), the `theme` specifies the Substance theme to be used to compute the gradient colors, while `decorationAreaType` indicates the decoration area type.

### Management API

If you wish to use the decoration painter of the current skin to provide additional custom painting in your application, call:

- `SubstanceLookAndFeel.getCurrentSkin()` to retrieve the current skin.
- `SubstanceSkin.getDecorationPainter()` to retrieve the decoration painter of the current skin.
- `SubstanceDecorationPainter.paintDecorationArea()` to paint the decoration background on the specific graphics context.