package javax.swing.plaf.nimbus;
import java.awt.*;
import java.awt.geom.*;
import java.awt.image.*;
import javax.swing.*;
import javax.swing.Painter;
final class TreeCellEditorPainter extends AbstractRegionPainter {
static final int BACKGROUND_DISABLED = 1;
static final int BACKGROUND_ENABLED = 2;
static final int BACKGROUND_ENABLED_FOCUSED = 3;
static final int BACKGROUND_SELECTED = 4;
private int state;
private PaintContext ctx;
private Path2D path = new Path2D.Float();
private Rectangle2D rect = new Rectangle2D.Float(0, 0, 0, 0);
private RoundRectangle2D roundRect = new RoundRectangle2D.Float(0, 0, 0, 0, 0, 0);
private Ellipse2D ellipse = new Ellipse2D.Float(0, 0, 0, 0);
private Color color1 = decodeColor("nimbusBlueGrey", 0.0f, -0.017358616f, -0.11372548f, 0);
private Color color2 = decodeColor("nimbusFocus", 0.0f, 0.0f, 0.0f, 0);
private Object[] componentColors;
public TreeCellEditorPainter(PaintContext ctx, int state) {
super();
this.state = state;
this.ctx = ctx;
}
@Override
protected void doPaint(Graphics2D g, JComponent c, int width, int height, Object[] extendedCacheKeys) {
componentColors = extendedCacheKeys;
switch(state) {
case BACKGROUND_ENABLED: paintBackgroundEnabled(g); break;
case BACKGROUND_ENABLED_FOCUSED: paintBackgroundEnabledAndFocused(g); break;
}
}
@Override
protected final PaintContext getPaintContext() {
return ctx;
}
private void paintBackgroundEnabled(Graphics2D g) {
path = decodePath1();
g.setPaint(color1);
g.fill(path);
}
private void paintBackgroundEnabledAndFocused(Graphics2D g) {
path = decodePath2();
g.setPaint(color2);
g.fill(path);
}
private Path2D decodePath1() {
path.reset();
path.moveTo(decodeX(0.0f), decodeY(0.0f));
path.lineTo(decodeX(0.0f), decodeY(3.0f));
path.lineTo(decodeX(3.0f), decodeY(3.0f));
path.lineTo(decodeX(3.0f), decodeY(0.0f));
path.lineTo(decodeX(0.2f), decodeY(0.0f));
path.lineTo(decodeX(0.2f), decodeY(0.2f));
path.lineTo(decodeX(2.8f), decodeY(0.2f));
path.lineTo(decodeX(2.8f), decodeY(2.8f));
path.lineTo(decodeX(0.2f), decodeY(2.8f));
path.lineTo(decodeX(0.2f), decodeY(0.0f));
path.lineTo(decodeX(0.0f), decodeY(0.0f));
path.closePath();
return path;
}
private Path2D decodePath2() {
path.reset();
path.moveTo(decodeX(0.0f), decodeY(0.0f));
path.lineTo(decodeX(0.0f), decodeY(3.0f));
path.lineTo(decodeX(3.0f), decodeY(3.0f));
path.lineTo(decodeX(3.0f), decodeY(0.0f));
path.lineTo(decodeX(0.24000001f), decodeY(0.0f));
path.lineTo(decodeX(0.24000001f), decodeY(0.24000001f));
path.lineTo(decodeX(2.7600007f), decodeY(0.24000001f));
path.lineTo(decodeX(2.7600007f), decodeY(2.7599998f));
path.lineTo(decodeX(0.24000001f), decodeY(2.7599998f));
path.lineTo(decodeX(0.24000001f), decodeY(0.0f));
path.lineTo(decodeX(0.0f), decodeY(0.0f));
path.closePath();
return path;
}
}