2
* Copyright 2005-2010 Kirill Grouchnikov, based on work by
3
* Sun Microsystems, Inc. All rights reserved.
5
* This library is free software; you can redistribute it and/or
6
* modify it under the terms of the GNU Lesser General Public
7
* License as published by the Free Software Foundation; either
8
* version 2.1 of the License, or (at your option) any later version.
10
* This library is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* Lesser General Public License for more details.
15
* You should have received a copy of the GNU Lesser General Public
16
* License along with this library; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19
package org.pushingpixels.substance.swingx;
21
import java.awt.Graphics2D;
22
import java.util.List;
24
import javax.swing.JComponent;
25
import javax.swing.JSeparator;
27
import org.pushingpixels.substance.api.*;
28
import org.pushingpixels.substance.api.painter.overlay.SubstanceOverlayPainter;
29
import org.pushingpixels.substance.internal.painter.BackgroundPaintingUtils;
30
import org.pushingpixels.substance.internal.painter.SeparatorPainterUtils;
32
public class SubstanceSwingxFillBackgroundDelegate {
33
public void paint(JComponent component, Graphics2D graphics,
34
boolean paintSeparator) {
35
BackgroundPaintingUtils.updateIfOpaque(graphics, component);
37
SubstanceSkin skin = SubstanceLookAndFeel.getCurrentSkin(component);
38
DecorationAreaType decorationAreaType = SubstanceLookAndFeel
39
.getDecorationType(component);
40
List<SubstanceOverlayPainter> overlayPainters = skin
41
.getOverlayPainters(decorationAreaType);
42
// only if there are no overlays specified on this decoration area
44
if (overlayPainters.size() == 0) {
45
// paint the separator on top.
46
SeparatorPainterUtils.paintSeparator(component, graphics,
47
component.getWidth(), 0, JSeparator.HORIZONTAL, false,