// Prepare the decorators
DecoratorSequence decorators = component.getDecorators();
int n = decorators.getLength();
for (int j = n - 1; j >= 0; j--) {
Decorator decorator = decorators.get(j);
decoratedGraphics = decorator.prepare(component, decoratedGraphics);
}
// Paint the component
Graphics2D componentGraphics = (Graphics2D)decoratedGraphics.create();
componentGraphics.clipRect(0, 0, componentBounds.width, componentBounds.height);
component.paint(componentGraphics);
componentGraphics.dispose();
// Update the decorators
for (int j = 0; j < n; j++) {
Decorator decorator = decorators.get(j);
decorator.update();
}
}
}
}