Package org.pushingpixels.substance.internal.painter

# Class DecorationPainterUtils

java.lang.Object
org.pushingpixels.substance.internal.painter.DecorationPainterUtils

public class DecorationPainterUtils extends Object
Contains utility methods related to decoration painters. This class is for internal use only.

## Constructor Summary

Constructors
Constructor
Description
`DecorationPainterUtils()`

## Method Summary

Modifier and Type
Method
Description
`static void`
`clearDecorationType(JComponent comp)`
Clears the client properties related to the decoration area type.
`static DecorationAreaType`
`getDecorationType(Component comp)`
Returns the decoration area type of the specified component.
`static DecorationAreaType`
`getImmediateDecorationType(Component comp)`
Returns the immediate decoration area type of the specified component.
`static void`
`paintDecorationBackground(Graphics g, Component c, boolean force)`
Paints the decoration background on the specified component.
`static void`
`paintDecorationBackground(Graphics g, Component c, DecorationAreaType decorationType, boolean force)`
Paints the decoration background on the specified component.
`static void`
`setDecorationType(JComponent comp, DecorationAreaType type)`
Sets the decoration type of the specified component.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### DecorationPainterUtils

public DecorationPainterUtils()

## Method Details

### setDecorationType

public static void setDecorationType(JComponent comp, DecorationAreaType type)
Sets the decoration type of the specified component.

Parameters:
  `comp` - Component.
  `type` - Decoration type of the component and its children.

### clearDecorationType

public static void clearDecorationType(JComponent comp)
Clears the client properties related to the decoration area type.

Parameters:
  `comp` - Component.

### getDecorationType

public static DecorationAreaType getDecorationType(Component comp)
Returns the decoration area type of the specified component. The component and its ancestor hierarchy are scanned for the registered decoration area type. If `setDecorationType(JComponent, DecorationAreaType)` has been called on the specified component, the matching decoration type is returned. Otherwise, the component hierarchy is scanned to find the closest ancestor that was passed to `setDecorationType(JComponent, DecorationAreaType)` - and its decoration type is returned. If neither the component, nor any one of its parent components has been passed to the setter method, `DecorationAreaType.NONE` is returned.

Parameters:
  `comp` - Component.
Returns:
  Decoration area type of the component.

### getImmediateDecorationType

public static DecorationAreaType getImmediateDecorationType(Component comp)
Returns the immediate decoration area type of the specified component. The component is checked for the registered decoration area type. If `setDecorationType(javax.swing.JComponent, org.pushingpixels.substance.api.DecorationAreaType)` was not called on this component, this method returns `null`.

Parameters:
  `comp` - Component.
Returns:
  Immediate decoration area type of the component.

### paintDecorationBackground

public static void paintDecorationBackground(Graphics g, Component c, boolean force)
Paints the decoration background on the specified component. The decoration background is not painted when the `force` parameter is `false` and at least one of the following conditions holds:

- The component is in a cell renderer.
- The component is not showing on the screen.
- The component is in the preview mode.

Parameters:
  `g` - Graphics context.
  `c` - Component.
  `force` - If `true`, the painting of decoration background is enforced.

### paintDecorationBackground

public static void paintDecorationBackground(Graphics g, Component c, DecorationAreaType decorationType, boolean force)
Paints the decoration background on the specified component. See comments on `paintDecorationBackground(Graphics, Component, boolean)` for the cases when the decoration background painting is skipped.

Parameters:
  `g` - Graphics context.
  `c` - Component.
  `decorationType` - Decoration area type of the component.
  `force` - If `true`, the painting of decoration background is enforced. #see `paintDecorationBackground(Graphics, Component, boolean)`