Java Code Examples for java.awt.Graphics2D#getColor()

The following examples show how to use java.awt.Graphics2D#getColor() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SpotsController.java    From audiveris with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public void renderItems (Graphics2D g)
{
    // (Phase #2) Render sections (on top of rendered spots)
    super.render(g);

    // (Phase #3) Render spots mean line
    final Rectangle clip = g.getClipBounds();
    final Stroke oldStroke = UIUtil.setAbsoluteStroke(g, 1f);
    final Color oldColor = g.getColor();
    g.setColor(Color.RED);

    for (Glyph spot : spots) {
        if ((clip == null) || clip.intersects(spot.getBounds())) {
            spot.renderLine(g); // Draw glyph mean line
        }
    }

    g.setColor(oldColor);
    g.setStroke(oldStroke);
}
 
Example 2
Source File: GridRenderer.java    From energy2d with GNU Lesser General Public License v3.0 6 votes vote down vote up
void render(JComponent c, Graphics2D g) {

		int w = c.getWidth();
		int h = c.getHeight();
		float dx = (float) w / (float) nx;
		float dy = (float) h / (float) ny;

		Color oldColor = g.getColor();
		Stroke oldStroke = g.getStroke();
		g.setColor(color);
		g.setStroke(stroke);

		int k;
		for (int i = 0; i < nx; i += gridSize) {
			k = Math.round(i * dx);
			g.drawLine(k, 0, k, h);
		}
		for (int i = 0; i < ny; i += gridSize) {
			k = Math.round(i * dy);
			g.drawLine(0, k, w, k);
		}

		g.setColor(oldColor);
		g.setStroke(oldStroke);

	}
 
Example 3
Source File: SpotsController.java    From audiveris with GNU Affero General Public License v3.0 6 votes vote down vote up
@Override
public void render (Graphics2D g)
{
    // (Phase #1) Render all spots
    final Rectangle clip = g.getClipBounds();
    final Color oldColor = g.getColor();
    g.setColor(Color.LIGHT_GRAY);

    for (Glyph spot : spots) {
        if ((clip == null) || clip.intersects(spot.getBounds())) {
            spot.getRunTable().render(g, spot.getTopLeft()); // Draw glyph
        }
    }

    g.setColor(oldColor);
}
 
Example 4
Source File: View2D.java    From energy2d with GNU Lesser General Public License v3.0 6 votes vote down vote up
private void drawTextBoxes(Graphics2D g) {
	if (textBoxes.isEmpty())
		return;
	Font oldFont = g.getFont();
	Color oldColor = g.getColor();
	String s = null;
	for (TextBox x : textBoxes) {
		if (!x.isVisible())
			continue;
		g.setFont(new Font(x.getFace(), x.getStyle(), x.getSize()));
		g.setColor(x.getColor());
		s = x.getLabel();
		if (s != null) {
			s = s.replaceAll("%Prandtl", formatter.format(model.getPrandtlNumber()));
			s = s.replaceAll("%thermal_energy", "" + Math.round(model.getThermalEnergy()));
			drawStringWithLineBreaks(g, s, x);
		}
	}
	g.setFont(oldFont);
	g.setColor(oldColor);
}
 
Example 5
Source File: LineBorder.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Paints the border for the specified component with the
 * specified position and size.
 * @param c the component for which this border is being painted
 * @param g the paint graphics
 * @param x the x position of the painted border
 * @param y the y position of the painted border
 * @param width the width of the painted border
 * @param height the height of the painted border
 */
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
    if ((this.thickness > 0) && (g instanceof Graphics2D)) {
        Graphics2D g2d = (Graphics2D) g;

        Color oldColor = g2d.getColor();
        g2d.setColor(this.lineColor);

        Shape outer;
        Shape inner;

        int offs = this.thickness;
        int size = offs + offs;
        if (this.roundedCorners) {
            float arc = .2f * offs;
            outer = new RoundRectangle2D.Float(x, y, width, height, offs, offs);
            inner = new RoundRectangle2D.Float(x + offs, y + offs, width - size, height - size, arc, arc);
        }
        else {
            outer = new Rectangle2D.Float(x, y, width, height);
            inner = new Rectangle2D.Float(x + offs, y + offs, width - size, height - size);
        }
        Path2D path = new Path2D.Float(Path2D.WIND_EVEN_ODD);
        path.append(outer, false);
        path.append(inner, false);
        g2d.fill(path);
        g2d.setColor(oldColor);
    }
}
 
Example 6
Source File: HexMap.java    From Rails with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void paintImage(Graphics2D g) {
    try {
        // Abort if called too early.
        Rectangle rectClip = g.getClipBounds();
        if (rectClip == null) {
            return;
        }

        // paint train paths
        if (hexMap.getTrainPaths() != null) {
            Stroke oldStroke = g.getStroke();
            Color oldColor = g.getColor();
            Stroke trainStroke =
                    new BasicStroke((int) (STROKE_WIDTH * hexMap.getZoomFactor()),
                            STROKE_CAP, STROKE_JOIN);
            g.setStroke(trainStroke);

            Color[] trainColors =
                    new Color[] { colour1, colour2, colour3, colour4 };
            int color = 0;
            for (GeneralPath path:hexMap.getTrainPaths()) {
                g.setColor(trainColors[color++ % trainColors.length]);
                g.draw(path);
            }
            g.setStroke(oldStroke);
            g.setColor(oldColor);
        }
    } catch (NullPointerException ex) {
        // If we try to paint before something is loaded, just retry
        // later.
        log.debug("Premature call to RoutesLayer.paintImage(Graphics g)");
    }
}
 
Example 7
Source File: CurvedFilament.java    From audiveris with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void renderLine (Graphics2D g,
                        boolean showPoints,
                        double pointWidth)
{
    Rectangle clip = g.getClipBounds();

    if ((clip != null) && !clip.intersects(getBounds())) {
        return;
    }

    // The curved line itself
    if (spline != null) {
        g.draw(spline);
    }

    // Then the absolute defining points?
    if (showPoints && (points != null)) {
        // Point radius
        double r = pointWidth / 2;
        Ellipse2D ellipse = new Ellipse2D.Double();

        for (Point2D p : points) {
            ellipse.setFrame(p.getX() - r, p.getY() - r, 2 * r, 2 * r);

            Color oldColor = null;

            if (p.getClass() != Point2D.Double.class) {
                oldColor = g.getColor();
                g.setColor(Color.red);
            }

            g.fill(ellipse);

            if (oldColor != null) {
                g.setColor(oldColor);
            }
        }
    }
}
 
Example 8
Source File: FermataArcSymbol.java    From audiveris with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
protected void paint (Graphics2D g,
                      Params params,
                      Point location,
                      Alignment alignment)
{
    // We paint the full fermata symbol first
    // Then we paint a dot using white or decoComposite
    MyParams p = (MyParams) params;
    Alignment align = (shape == Shape.FERMATA_ARC) ? BOTTOM_CENTER : TOP_CENTER;
    Point loc = alignment.translatedPoint(align, p.rect, location);

    MusicFont.paint(g, p.layout, loc, align); // Arc + Dot

    if (decorated) {
        // Paint dot in gray
        Composite oldComposite = g.getComposite();
        g.setComposite(decoComposite);
        MusicFont.paint(g, p.dotLayout, loc, align);
        g.setComposite(oldComposite);
    } else {
        // Erase dot using white color (?)
        Color oldColor = g.getColor();
        g.setColor(Color.WHITE);
        MusicFont.paint(g, p.dotLayout, loc, align);
        g.setColor(oldColor);
    }
}
 
Example 9
Source File: TeXIcon.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Paint the {@link TeXFormula} that created this icon.
 */
public void paintIcon(Component c, Graphics g, int x, int y) {
    Graphics2D g2 = (Graphics2D) g;
    // copy graphics settings
    RenderingHints oldHints = g2.getRenderingHints();
    AffineTransform oldAt = g2.getTransform();
    Color oldColor = g2.getColor();

    // new settings
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                        RenderingHints.VALUE_ANTIALIAS_ON);
    g2.setRenderingHint(RenderingHints.KEY_RENDERING,
                        RenderingHints.VALUE_RENDER_QUALITY);
    g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
                        RenderingHints.VALUE_TEXT_ANTIALIAS_ON);

    g2.scale(size, size); // the point size
    if (fg != null) {
        g2.setColor(fg);
    } else if (c != null) {
        g2.setColor(c.getForeground()); // foreground will be used as default painting color
    } else {
        g2.setColor(defaultColor);
    }

    // draw formula box
    box.draw(g2, (x + insets.left) / size, (y + insets.top) / size+ box.getHeight());

    // restore graphics settings
    g2.setRenderingHints(oldHints);
    g2.setTransform(oldAt);
    g2.setColor(oldColor);
}
 
Example 10
Source File: BoundingBoxImagePanel.java    From amazon-kinesis-video-streams-parser-library with Apache License 2.0 5 votes vote down vote up
private void drawFaces(final Graphics2D g2, final int width, final int height,
                              final BoundingBox boundingBox, final String personName, final Color color) {
    final Color c = g2.getColor();

    g2.setColor(color);
    // Draw bounding box
    drawBoundingBox(g2, width, height, boundingBox);

    // Draw title
    drawFaceTitle(g2, width, height, boundingBox, personName);
    g2.setColor(c);
}
 
Example 11
Source File: PIDEF0painter.java    From ramus with GNU General Public License v3.0 5 votes vote down vote up
public void paint(final Graphics2D g, final double x, final double y,
                  final boolean fill, int partNumber, int hPageCount) {
    if (!function.isHaveChilds())
        return;

    final ArrowPainter painter = new ArrowPainter(movingArea);
    final int y1 = movingArea.getIntOrdinate(movingArea.TOP_PART_A);

    final int y2 = movingArea.getIntOrdinate(movingArea.CLIENT_HEIGHT);
    final int height = movingArea.getIntOrdinate(movingArea.BOTTOM_PART_A);
    final int x0 = (int) x + 1;
    final int y0 = (int) y + 1;

    if (fill) {
        final Color c = g.getColor();
        g.setColor(IDEFPanel.DEFAULT_BACKGROUND);
        g.fillRect(x0, y0,
                movingArea.getIntOrdinate(movingArea.MOVING_AREA_WIDTH), y1
                        + y2 + height);
        g.setColor(c);
    }

    g.setStroke(ArrowPainter.THIN_STROKE);
    g.translate(x0, y0);
    g.setColor(Color.BLACK);
    painter.paintTop(
            g// (Graphics2D)g.create(x0,y0,size.width,y1)
            , movingArea.getIntOrdinate(movingArea.TOP_PART_A), movingArea,
            partNumber, hPageCount);
    g.translate(0, y1);
    movingArea.paint(g);// g.create(x0,y0+y1,size.width,y2));

    g.setStroke(ArrowPainter.THIN_STROKE);

    g.translate(0, y2);
    g.setColor(Color.BLACK);
    painter.paintBottom(g, height, movingArea, partNumber, hPageCount);
}
 
Example 12
Source File: MtcnnUtil.java    From mtcnn-java with Apache License 2.0 5 votes vote down vote up
public static BufferedImage drawFaceAnnotations(BufferedImage originalImage, FaceAnnotation[] faceAnnotations) {

		Graphics2D g = originalImage.createGraphics();
		g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
		g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

		Stroke stroke = g.getStroke();
		Color color = g.getColor();
		g.setStroke(new BasicStroke(3));
		g.setColor(Color.YELLOW);

		int radius = 2;
		for (FaceAnnotation faceAnnotation : faceAnnotations) {
			FaceAnnotation.BoundingBox bbox = faceAnnotation.getBoundingBox();
			g.drawRect(bbox.getX(), bbox.getY(), bbox.getW(), bbox.getH());
			for (FaceAnnotation.Landmark lm : faceAnnotation.getLandmarks()) {
				g.fillOval(lm.getPosition().getX() - radius, lm.getPosition().getY() - radius,
						2 * radius, 2 * radius);
			}
		}

		g.setStroke(stroke);
		g.setColor(color);

		g.dispose();

		return originalImage;
	}
 
Example 13
Source File: PerspectiveFilter.java    From osp with GNU General Public License v3.0 5 votes vote down vote up
public void draw(DrawingPanel panel, Graphics g) {
 	if (!PerspectiveFilter.super.isEnabled()) return;
 	VideoPanel vidPanel = (VideoPanel)panel;
 	Corner[] corners = PerspectiveFilter.this.isEnabled()? outCorners: inCorners;
	for (int i=0; i<4; i++) {
		screenPts[i] = corners[i].getScreenPosition(vidPanel);
     transform.setToTranslation(screenPts[i].getX(), screenPts[i].getY());
     Shape s = corners[i]==selectedCorner? selectionShape: cornerShape;
     Stroke sk = corners[i]==selectedCorner? stroke: cornerStroke;
     hitShapes[i] = transform.createTransformedShape(s);
     drawShapes[i] = sk.createStrokedShape(hitShapes[i]);
	}
path.reset();
path.moveTo((float)screenPts[0].getX(), (float)screenPts[0].getY());
path.lineTo((float)screenPts[1].getX(), (float)screenPts[1].getY());
path.lineTo((float)screenPts[2].getX(), (float)screenPts[2].getY());
path.lineTo((float)screenPts[3].getX(), (float)screenPts[3].getY());
path.closePath();
drawShapes[4] = stroke.createStrokedShape(path);
Graphics2D g2 = (Graphics2D)g;
   Color gcolor = g2.getColor();
   g2.setColor(color);
   Font gfont = g.getFont();
   g2.setFont(font);
   g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                      RenderingHints.VALUE_ANTIALIAS_ON);
   for (int i=0; i< drawShapes.length; i++) {
   	g2.fill(drawShapes[i]);
   }
   for (int i=0; i<textLayouts.length; i++) {
     p.setLocation(screenPts[i].getX()-4-font.getSize(), screenPts[i].getY()-6);
   	textLayouts[i].draw(g2, p.x, p.y);
   }
   g2.setFont(gfont);
   g2.setColor(gcolor);
}
 
Example 14
Source File: NonDraggableSymbol.java    From libreveris with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
protected void paint (Graphics2D g,
                      Params p,
                      Point location,
                      Alignment alignment)
{
    Color oldColor = g.getColor();
    g.setColor(Color.RED);
    super.paint(g, p, location, alignment);
    g.setColor(oldColor);
}
 
Example 15
Source File: Graphics2DStore.java    From RipplePower with Apache License 2.0 5 votes vote down vote up
public void save(Graphics2D g2d) {
	paint = g2d.getPaint();
	font = g2d.getFont();
	stroke = g2d.getStroke();
	transform = g2d.getTransform();
	composite = g2d.getComposite();
	clip = g2d.getClip();
	renderingHints = g2d.getRenderingHints();
	color = g2d.getColor();
	background = g2d.getBackground();
}
 
Example 16
Source File: NaturalSpline.java    From audiveris with GNU Affero General Public License v3.0 4 votes vote down vote up
/**
 * Paint the spline on the provided environment, perhaps with its defining points.
 *
 * @param g          the graphics context
 * @param showPoints true to show the defining points
 * @param pointWidth width for any displayed defining point
 */
public void render (Graphics2D g,
                    boolean showPoints,
                    double pointWidth)
{
    final Rectangle clip = g.getClipBounds();

    if (clip != null) {
        final Rectangle bounds = getBounds();
        bounds.grow(1, 1); // Since interior of a perfect vertical or horizontal line is void!

        if (!clip.intersects(bounds)) {
            return;
        }
    }

    // The spline itself
    g.draw(this);

    // Then the defining points?
    if (showPoints) {
        Color oldColor = g.getColor();
        g.setColor(Color.RED);

        final double r = pointWidth / 2; // Point radius
        final Ellipse2D ellipse = new Ellipse2D.Double();
        final double[] coords = new double[6];
        final PathIterator it = getPathIterator(null);

        while (!it.isDone()) {
            final int segmentKind = it.currentSegment(coords);
            final int count = countOf(segmentKind);
            final double x = coords[count - 2];
            final double y = coords[count - 1];
            ellipse.setFrame(x - r, y - r, 2 * r, 2 * r);
            g.fill(ellipse);
            it.next();
        }

        g.setColor(oldColor);
    }
}
 
Example 17
Source File: FreeForm.java    From dsworkbench with Apache License 2.0 4 votes vote down vote up
public void renderPreview(Graphics2D g2d) {
    if (points.size() < 1) {
        return;
    }
    //store properties
    Stroke sBefore = g2d.getStroke();
    Color cBefore = g2d.getColor();
    Composite coBefore = g2d.getComposite();
    Font fBefore = g2d.getFont();
    //draw
    g2d.setStroke(getStroke());
    g2d.setColor(drawColor);
    g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, drawAlpha));

    GeneralPath p = new GeneralPath();
    Point2D.Double pp = points.get(0);
    p.moveTo(pp.x, pp.y);
    for (int i = 0; i <= points.size() - 1; i++) {
        pp = points.get(i);
        p.lineTo(pp.x, pp.y);
    }

    if (filled) {
        g2d.fill(p);
    } else {
        g2d.draw(p);
    }

    if (drawName) {
        g2d.setColor(getTextColor());
        g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, getTextAlpha()));
        g2d.setFont(fBefore.deriveFont((float) getTextSize()));
        Rectangle2D textBounds = g2d.getFontMetrics().getStringBounds(getFormName(), g2d);
        java.awt.Rectangle bounds = p.getBounds();
        g2d.drawString(getFormName(), (int) Math.rint(bounds.getX() + bounds.getWidth() / 2 - textBounds.getWidth() / 2), (int) Math.rint(bounds.getY() + bounds.getHeight() / 2 + textBounds.getHeight() / 2));
    }
    g2d.setStroke(sBefore);
    g2d.setColor(cBefore);
    g2d.setComposite(coBefore);
    g2d.setFont(fBefore);
}
 
Example 18
Source File: DataToolTable.java    From osp with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Draw green shapes surrounding the working data points.
 *
 * @param  drawingPanel
 * @param  g2
 */
protected void drawSurrounds(DrawingPanel drawingPanel, Graphics2D g2) {
	// set up graphics
  Color c = g2.getColor();
  Stroke s = g2.getStroke();
  g2.setColor(new Color(51, 255, 51, 153));
  g2.setStroke(new BasicStroke(2));
  
  // set up shape size
  Shape shape = null;
  int radius = getMarkerSize()+2;
  int marker = getMarkerShape();
  if (marker==NO_MARKER || marker==PIXEL) {
  	radius = 3;
  }
  int size = radius*2+1;
  
  // get data points
  double[] tempX = getXPoints();
  double[] tempY = getYPoints();      
  double xp = 0;
  double yp = 0;
  
  // draw surrounds
  for(int i = 0; i<index; i++) {
    if(Double.isNaN(tempY[i])) {
      continue;
    }
    if(drawingPanel.isLogScaleX()&&(tempX[i]<=0)) {
      continue;
    }
    if(drawingPanel.isLogScaleY()&&(tempY[i]<=0)) {
      continue;
    }
    xp = drawingPanel.xToPix(tempX[i]);
    yp = drawingPanel.yToPix(tempY[i]);
    if (marker==SQUARE || marker==POST || marker==BAR) {
      shape = new Rectangle2D.Double(xp-radius, yp-radius, size, size);        	
    }
    else shape = new Ellipse2D.Double(xp-radius, yp-radius, size, size);
    g2.draw(shape);
  }
  
  // restore graphics
  g2.setColor(c);
  g2.setStroke(s);
}
 
Example 19
Source File: GraphicsRenderer.java    From CSSBox with GNU Lesser General Public License v3.0 4 votes vote down vote up
/** 
 * Draws the background and border of an element box.
 * @param g the graphics context used for drawing 
 */
protected void drawBackground(ElementBox elem, Graphics2D g)
{
    Color color = g.getColor(); //original color
    Shape oldclip = setupBoxClip(g, elem); //original clip region
    setupGraphics(g, (GraphicsVisualContext) elem.getVisualContext());
    
    //border bounds
    Rectangle brd = elem.getAbsoluteBorderBounds();
    
    //draw the background
    BackgroundDecoder bg = findBackgroundSource(elem);
    if (bg != null)
    {
        //draw the background color
        if (bg.getBgcolor() != null)
        {
            g.setColor(convertColor(bg.getBgcolor()));
            final Rectangle2D abrd = awtRect2D(brd);
            g.fill(abrd);
        }
        
        //draw the background images
        if (bg.getBackgroundImages() != null)
        {
            final BackgroundBitmap bitmap = new BackgroundBitmap(elem);
            for (int i = bg.getBackgroundImages().size() - 1; i >= 0; i--)
            {
                BackgroundImage img = bg.getBackgroundImages().get(i);
                if (img instanceof BackgroundImageImage)
                {
                    bitmap.addBackgroundImage((BackgroundImageImage) img);
                }
                else if (img instanceof BackgroundImageGradient)
                {
                    bitmap.addBackgroundImage((BackgroundImageGradient) img);
                }
            }
            if (bitmap.getBufferedImage() != null)
            {
                g.drawImage(bitmap.getBufferedImage(), Math.round(brd.x), Math.round(brd.y), null);
            }
        }
    }
    
    //draw the border
    drawBorders(elem, g, brd.x, brd.y, brd.x + brd.width - 1, brd.y + brd.height - 1);
    
    g.setClip(oldclip); //restore the clipping
    g.setColor(color); //restore original color
}
 
Example 20
Source File: Legenda.java    From brModelo with GNU General Public License v3.0 4 votes vote down vote up
@Override
    public void DoPaint(Graphics2D g) {
        super.DoPaint(g);
        Rectangle rec = getArea();
        Color bkpc = g.getColor();

        g.setColor(getBorderColor());

        g.drawRect(rec.x, rec.y, rec.width, rec.height);

        Rectangle bkp = g.getClipBounds();
        g.clipRect(rec.x, rec.y, rec.width, rec.height);

        Font fn = getFont();
        Font font = new Font(fn.getFontName(), fn.getStyle(), fn.getSize() - 2);

        fn = g.getFont();
        g.setFont(font);

        altura = g.getFontMetrics().getHeight() + g.getFontMetrics().getDescent();
        alturaTitulo = altura + altura / 2;

        Composite originalComposite = g.getComposite();
        float alfa = 0.8f;
        g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alfa));

        if (getTipo() == TipoLegenda.tpObjetos) {
            altura = Math.max(32, altura);
        }

        int posi = altura + alturaTitulo + rec.y;
        final int lft = rec.x + 2;

        for (ItemDeLegenda it : getItens()) {

            if (it.isSelecionada()) {
                g.setColor(isDisablePainted()? disabledColor : new Color(204, 204, 255, 50));
                g.fillRect(lft, posi - altura - 2, getWidth(), altura + 4);
            }
            g.setColor(isDisablePainted()? disabledColor : it.cor);
            int moveleft;
            switch (getTipo()) {
                case tpLinhas:
                    moveleft = 3 * altura;
                    g.fillRoundRect(lft, posi - (altura / 2) - 2, moveleft - 2, 4, 2, 2);
                    g.setColor(bkpc);
                    g.drawString(it.texto, lft + moveleft, posi - 6);
                    break;
                case tpObjetos:
                    ImageIcon img = Editor.fromControler().getImagemNormal(getMaster().getCassesDoDiagrama()[it.getTag()].getSimpleName());
                    g.drawImage(util.TratadorDeImagens.ReColorBlackImg(img, it.getCor()), lft, posi - altura, null);
                    moveleft = altura + 2;
                    g.drawString(it.texto, lft + moveleft, posi - altura / 2 + 6);
                    break;
                default:
                    moveleft = altura;
                    g.fillRect(lft, posi - altura, altura - 4, altura - 4);
                    g.setColor(bkpc);
                    g.drawRect(lft, posi - altura, altura - 4, altura - 4);
                    g.drawString(it.texto, lft + moveleft, posi - 6);
            }
            it.Area = new Point(posi - altura - 2, altura + 4);
            posi += altura + 4;
        }

        g.setComposite(originalComposite);

//        g.setColor(Color.LIGHT_GRAY);
//        g.drawLine(lft - 1, posi - altura - 2, getLeft() + getWidth() - 1, posi - altura - 2);
        g.setClip(bkp);
        g.setFont(fn);
    }