当前位置: 首页>>代码示例>>Java>>正文


Java Graphics2D.setClip方法代码示例

本文整理汇总了Java中java.awt.Graphics2D.setClip方法的典型用法代码示例。如果您正苦于以下问题:Java Graphics2D.setClip方法的具体用法?Java Graphics2D.setClip怎么用?Java Graphics2D.setClip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.Graphics2D的用法示例。


在下文中一共展示了Graphics2D.setClip方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: draw

import java.awt.Graphics2D; //导入方法依赖的package包/类
private static void draw(Shape clip, Shape to, Image vi, BufferedImage bi,
                         int scale) {
    Graphics2D big = bi.createGraphics();
    big.setComposite(AlphaComposite.Src);
    big.setClip(clip);
    Rectangle toBounds = to.getBounds();
    int x1 = toBounds.x;

    int y1 = toBounds.y;
    int x2 = x1 + toBounds.width;
    int y2 = y1 + toBounds.height;
    big.drawImage(vi, x1, y1, x2, y2, 0, 0, toBounds.width / scale,
                  toBounds.height / scale, null);
    big.dispose();
    vi.flush();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:17,代码来源:IncorrectClipSurface2SW.java

示例2: drawNoDataMessage

import java.awt.Graphics2D; //导入方法依赖的package包/类
/**
     * Draws a message to state that there is no data to plot.
     *
     * @param g2  the graphics device.
     * @param area  the area within which the plot should be drawn.
     */
    protected void drawNoDataMessage(Graphics2D g2, Rectangle2D area) {

        Shape savedClip = g2.getClip();
        g2.clip(area);
        String message = this.noDataMessage;
        if (message != null) {
            g2.setFont(this.noDataMessageFont);
            g2.setPaint(this.noDataMessagePaint);
//            FontMetrics fm = g2.getFontMetrics(this.noDataMessageFont);
//            Rectangle2D bounds = TextUtilities.getTextBounds(message, g2, fm);
//            float x = (float) (area.getX() + area.getWidth() / 2 - bounds.getWidth() / 2);
//            float y = (float) (area.getMinY() + (area.getHeight() / 2) - (bounds.getHeight() / 2));
//            g2.drawString(message, x, y);
            TextBlock block = TextUtilities.createTextBlock(
                this.noDataMessage, this.noDataMessageFont, this.noDataMessagePaint, 
                0.9f * (float) area.getWidth(), new G2TextMeasurer(g2)
            );
            block.draw(
                g2, (float) area.getCenterX(), (float) area.getCenterY(), TextBlockAnchor.CENTER
            );
        }
        g2.setClip(savedClip);

    }
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:31,代码来源:Plot.java

示例3: paintBase

import java.awt.Graphics2D; //导入方法依赖的package包/类
@Override
protected void paintBase(Graphics2D g) {
    if (endOFF) {
        return;
    }
    setArea(null);
    Rectangle r = this.getBounds();
    g.setColor(Color.GRAY);
    g.drawRoundRect(0, 0, r.width - 1, r.height - 1, 10, 10);

    g.setColor(Color.lightGray);
    g.drawRoundRect(5, 5, r.height - 10, r.height - 10, 4,4);

    int met = (r.height - 11) / 2;
    g.setColor(Color.black);
    g.drawLine(7, 6 + met, r.height - 7, 6 + met);
    if ('+' == getEstado()) {
        g.drawLine(6 + met, 7, 6 + met, r.height - 7);
    }

    g.setColor(Color.BLACK);
    Rectangle bkp = g.getClipBounds();
    g.clipRect(0, 0, r.width - 1, r.height);
    if (isSelecionado()) {
        g.setFont(new Font(this.getFont().getFontName(), Font.BOLD, getFont().getSize()));
        g.drawRoundRect(0, 0, r.width - 1, r.height - 1, 10, 10);
    }
    int tmp = (r.width - g.getFontMetrics().stringWidth(getTexto())) / 2;

    g.drawString(getTexto(), tmp, (int) (r.height * 0.72));
    g.setClip(bkp);
}
 
开发者ID:chcandido,项目名称:brModelo,代码行数:33,代码来源:InspectorItemSeparador.java

示例4: renderTo

import java.awt.Graphics2D; //导入方法依赖的package包/类
private static void renderTo(BufferedImage dst) {
    System.out.println("The buffer: " + dst);
    Graphics2D g = dst.createGraphics();

    final int w = dst.getWidth();
    final int h = dst.getHeight();

    g.setColor(Color.blue);
    g.fillRect(0, 0, w, h);

    g.setColor(Color.red);
    Font f = g.getFont();
    g.setFont(f.deriveFont(48f));

    g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
           RenderingHints.VALUE_TEXT_ANTIALIAS_ON);

    // NB: this clip ctriggers the problem
    g.setClip(50, 50, 200, 100);

    g.drawString("AA Text", 52, 90);

    g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
           RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);

    // NB: this clip ctriggers the problem
    g.setClip(50, 100, 100, 100);
    g.drawString("Text", 52, 148);

    g.dispose();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:32,代码来源:RenderToCustomBufferTest.java

示例5: draw

import java.awt.Graphics2D; //导入方法依赖的package包/类
private static void draw(Shape clip, Shape shape, Image from, Image to) {
    Graphics2D g2d = (Graphics2D) to.getGraphics();
    g2d.setXORMode(Color.BLACK);
    g2d.setClip(clip);
    Rectangle toBounds = shape.getBounds();
    g2d.drawImage(from, toBounds.x, toBounds.y, toBounds.width,
                  toBounds.height, null);
    g2d.dispose();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:10,代码来源:IncorrectClipXorModeSurface2Surface.java

示例6: paintTringle

import java.awt.Graphics2D; //导入方法依赖的package包/类
@Override
public void paintTringle(Graphics2D g) {
    if (paintTriangle >= 0) {

        final Rectangle2D rect = movingArea.getBounds(getBounds());
        Ellipse2D ellipse = new Ellipse2D.Double(rect.getX(), rect.getY(),
                rect.getWidth(), rect.getHeight());
        g.setClip(ellipse);

        g.fill(getTrianglePath(paintTriangle).createTransformedShape(
                AffineTransform.getScaleInstance(movingArea.zoom,
                        movingArea.zoom)));
        g.setClip(null);
    }
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:16,代码来源:DFDFunctionEllipse.java

示例7: paintTringle

import java.awt.Graphics2D; //导入方法依赖的package包/类
@Override
public void paintTringle(Graphics2D g) {
    if (paintTriangle >= 0) {
        final Rectangle2D rect = movingArea.getBounds(getBounds());
        RoundRectangle2D rectangle2d = new RoundRectangle2D.Double(rect.getX(),
                rect.getY(), rect.getWidth(), rect.getHeight(),
                movingArea.getIDoubleOrdinate(20),
                movingArea.getIDoubleOrdinate(20));
        g.setClip(rectangle2d);
        g.fill(getTrianglePath(paintTriangle).createTransformedShape(
                AffineTransform.getScaleInstance(movingArea.zoom,
                        movingArea.zoom)));
        g.setClip(null);
    }
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:16,代码来源:DFDFunction.java

示例8: test

import java.awt.Graphics2D; //导入方法依赖的package包/类
private static void test(final Graphics2D g) {
    for (final Shape clip : clips) {
        g.setClip(clip);
        if (!g.getClip().equals(clip)) {
            System.err.println("Expected clip: " + clip);
            System.err.println("Actual clip: " + g.getClip());
            System.err.println("bounds="+g.getClip().getBounds2D());
            System.err.println("bounds="+g.getClip().getBounds());
            status = false;
        }
        final Rectangle bounds = g.getClipBounds();
        if (!clip.equals(bounds)) {
            System.err.println("Expected getClipBounds(): " + clip);
            System.err.println("Actual getClipBounds(): " + bounds);
            status = false;
        }
        g.getClipBounds(bounds);
        if (!clip.equals(bounds)) {
            System.err.println("Expected getClipBounds(r): " + clip);
            System.err.println("Actual getClipBounds(r): " + bounds);
            status = false;
        }
        if (!clip.getBounds2D().isEmpty() && ((SunGraphics2D) g).clipRegion
                .isEmpty()) {
            System.err.println("clipRegion should not be empty");
            status = false;
        }
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:30,代码来源:Test8004859.java

示例9: apply

import java.awt.Graphics2D; //导入方法依赖的package包/类
public void apply(Graphics2D g)
{
	g.setTransform(transform);
	g.setPaint(paint);
	g.setStroke(stroke);
	g.setFont(font);
	g.setComposite(composite);
	g.setBackground(bgrnd);
	g.setClip(shape);
	g.setRenderingHints(hints);
}
 
开发者ID:Chroniaro,项目名称:What-Happened-to-Station-7,代码行数:12,代码来源:TStack.java

示例10: DoPaint

import java.awt.Graphics2D; //导入方法依赖的package包/类
@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);
    }
 
开发者ID:chcandido,项目名称:brModelo,代码行数:73,代码来源:Legenda.java

示例11: getHighRes

import java.awt.Graphics2D; //导入方法依赖的package包/类
public static boolean getHighRes(double[] wesn, int width, int height, BufferedImage image) {
	getImage(wesn, width, height, image);
	Graphics2D g = image.createGraphics();
	Rectangle rect = new Rectangle(0, 0, width, height);
	double scale = (wesn[1] - wesn[0]) / (double)width;
	double r = 1/scale;
	if(r < (double)res[0]) return false;
	int ires = 0;
	while( r < (double)highRes[ires] && ires<highRes.length-1) ires++;
	if(ires == highRes.length-1) ires--;
	double gridScale = 600 / (double) highRes[ires];
	
	int x1 = (int) Math.floor( wesn[0] / gridScale);
	int x2 = (int) Math.ceil( wesn[1] / gridScale);
	int xmax = (int) Math.ceil( 360 / gridScale);

	int y1 = (int) Math.ceil( wesn[3] / gridScale);
	int y2 = (int) Math.floor( wesn[2] / gridScale);
	Rectangle clipRect = new Rectangle(8, 8, 600, 600);

	int xgrid, ygrid;
	String name;
	File file;
	double x0, y0;
	double west;
	double north;
	double offset;
	double pad = 8 / (double) highRes[ires];
	BufferedImage im = null;
	g.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
		RenderingHints.VALUE_INTERPOLATION_BILINEAR);
	AffineTransform at = new AffineTransform();
	boolean returnVal = false;
	for( int x=x1 ; x<x2 ; x++ ) {
		xgrid = x;
		offset = -pad;
		while(xgrid < 0) {
			xgrid += xmax;
			offset -= 360;
		}
		while(xgrid >= xmax) {
			xgrid -= xmax;
			offset += 360;
		}
		west = (double) xgrid * gridScale + offset;
		x0 = (west - wesn[0]) / scale;
		for( int y=y1 ; y>y2 ; y--) {
			
			north = (double)y *gridScale + pad;
			if( y>0 ) {
				name = "g" + highRes[ires] + "_" + xgrid + "_N" + y +".jpg";
			} else {
				ygrid = -y;
				name = "g" + highRes[ires] + "_" + xgrid + "_S" + ygrid +".jpg";
			}
			String url = "file:/usr/local/seabeam/kn166-14/copy/science/tiles/g"+highRes[ires]+"/" + name;
			im = null;
			try { 
				BufferedInputStream in = new BufferedInputStream(
					(URLFactory.url(url)).openStream());
				//JPEGImageDecoder decoder = JPEGCodec.createJPEGDecoder(in);
				//im = decoder.decodeAsBufferedImage();
				im = ImageIO.read(in);
				in.close();
			} catch ( Exception ioe) {
				continue;
			}
			g.setTransform(at);
			g.setClip(rect);
			y0 = (wesn[3] - north) / scale ;
			g.translate(x0, y0);
			double scl = 1 / ((double) highRes[ires] * scale);
			g.scale(scl, scl);
			g.clip(clipRect);
			returnVal = true;
			g.drawRenderedImage(im, at);
		}
	}
	return returnVal;
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:81,代码来源:MapServerB.java

示例12: paint

import java.awt.Graphics2D; //导入方法依赖的package包/类
@Override
public void paint(Graphics2D g, Shape alloc, Rectangle clipBounds) {
    Rectangle2D.Double allocBounds = ViewUtils.shape2Bounds(alloc);
    if (allocBounds.intersects(clipBounds)) {
        Font origFont = g.getFont();
        Color origColor = g.getColor();
        Color origBkColor = g.getBackground();
        Shape origClip = g.getClip();
        try {
            // Leave component font
            
            g.setBackground(getBackgroundColor());

            int xInt = (int) allocBounds.getX();
            int yInt = (int) allocBounds.getY();
            int endXInt = (int) (allocBounds.getX() + allocBounds.getWidth() - 1);
            int endYInt = (int) (allocBounds.getY() + allocBounds.getHeight() - 1);
            g.setColor(getBorderColor());
            g.drawRect(xInt, yInt, endXInt - xInt, endYInt - yInt);
            
            g.setColor(getForegroundColor());
            g.clearRect(xInt + 1, yInt + 1, endXInt - xInt - 1, endYInt - yInt - 1);
            g.clip(alloc);
            TextLayout textLayout = getTextLayout();
            if (textLayout != null) {
                EditorView.Parent parent = (EditorView.Parent) getParent();
                float ascent = parent.getViewRenderContext().getDefaultAscent();
                String desc = fold.getDescription(); // For empty desc a single-space text layout is returned
                float x = (float) (allocBounds.getX() + EXTRA_MARGIN_WIDTH);
                float y = (float) allocBounds.getY();
                if (desc.length() > 0) {
                    
                    textLayout.draw(g, x, y + ascent);
                }
            }
        } finally {
            g.setClip(origClip);
            g.setBackground(origBkColor);
            g.setColor(origColor);
            g.setFont(origFont);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:44,代码来源:FoldView.java

示例13: paintIndeterminate

import java.awt.Graphics2D; //导入方法依赖的package包/类
@Override
protected void paintIndeterminate(Graphics g, JComponent c) {
	boolean compressed = Boolean.parseBoolean(String.valueOf(progressBar
			.getClientProperty(RapidLookTools.PROPERTY_PROGRESSBAR_COMPRESSED)));

	int y = 0;
	int x = 0;
	int w;
	int h;
	if (compressed) {
		x = (int) (c.getWidth() * 0.67);
		w = (int) (c.getWidth() * 0.33);
		y = 3;
		h = c.getHeight() - 6;
	} else {
		w = c.getWidth();
		h = c.getHeight() / 2;
	}

	Graphics2D g2 = (Graphics2D) g;
	g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

	if (c.isOpaque()) {
		if (c.getParent() != null) {
			g2.setColor(c.getParent().getBackground());
		} else {
			g2.setColor(c.getBackground());
		}
		g2.fillRect(x, y, c.getWidth(), c.getHeight());
	}

	g2.setColor(Colors.PROGRESSBAR_BACKGROUND);
	g2.fillRoundRect(x + 1, y + 1, w - 2, h - 2, RapidLookAndFeel.CORNER_DEFAULT_RADIUS,
			RapidLookAndFeel.CORNER_DEFAULT_RADIUS);

	g2.setColor(Colors.PROGRESSBAR_BORDER);
	g2.drawRoundRect(x + 1, y + 1, w - 2, h - 2, RapidLookAndFeel.CORNER_DEFAULT_RADIUS,
			RapidLookAndFeel.CORNER_DEFAULT_RADIUS);

	// make sure we don't draw over the boundaries
	RoundRectangle2D clipRect = new RoundRectangle2D.Double(x + 3, y + 3, w - 5, h - 5,
			RapidLookAndFeel.CORNER_DEFAULT_RADIUS / 2, RapidLookAndFeel.CORNER_DEFAULT_RADIUS / 2);
	g2.setClip(clipRect);

	for (double xCoord = x + -4 * ANIMATION_BAR_LENGTH + System.currentTimeMillis() * ANIMATION_SPEED
			% (2 * ANIMATION_BAR_LENGTH); xCoord < x + w + 2 * ANIMATION_BAR_LENGTH;) {
		g2.setColor(Colors.PROGRESSBAR_INDETERMINATE_FOREGROUND_1);
		g2.fill(createIntermediateShape(xCoord, ANIMATION_BAR_LENGTH, h));
		xCoord += ANIMATION_BAR_LENGTH;
		g2.setColor(Colors.PROGRESSBAR_INDETERMINATE_FOREGROUND_2);
		g2.fill(createIntermediateShape(xCoord, ANIMATION_BAR_LENGTH, h));
		xCoord += ANIMATION_BAR_LENGTH;
	}
	g2.setClip(null);

	drawString(g2, w, h, compressed);
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:58,代码来源:ProgressBarUI.java

示例14: draw

import java.awt.Graphics2D; //导入方法依赖的package包/类
/**
 * Draws the plot on a Java 2D graphics device (such as the screen or a printer).
 * <P>
 * This plot relies on an {@link org.jfree.chart.renderer.DefaultPolarItemRenderer} to draw 
 * each item in the plot.  This allows the visual representation of the data to be changed 
 * easily.
 * <P>
 * The optional info argument collects information about the rendering of
 * the plot (dimensions, tooltip information etc).  Just pass in <code>null</code> if
 * you do not need this information.
 *
 * @param g2  the graphics device.
 * @param plotArea  the area within which the plot (including axes and labels) should be drawn.
 * @param parentState  ignored.
 * @param info  collects chart drawing information (<code>null</code> permitted).
 */
public void draw(Graphics2D g2, 
                 Rectangle2D plotArea, 
                 PlotState parentState,
                 PlotRenderingInfo info) {
   
    // if the plot area is too small, just return...
    boolean b1 = (plotArea.getWidth() <= MINIMUM_WIDTH_TO_DRAW);
    boolean b2 = (plotArea.getHeight() <= MINIMUM_HEIGHT_TO_DRAW);
    if (b1 || b2) {
        return;
    }
   
    // record the plot area...
    if (info != null) {
        info.setPlotArea(plotArea);
    }
   
    // adjust the drawing area for the plot insets (if any)...
    Insets insets = getInsets();
    if (insets != null) {
        plotArea.setRect(plotArea.getX() + insets.left,
                         plotArea.getY() + insets.top,
                         plotArea.getWidth() - insets.left - insets.right,
                         plotArea.getHeight() - insets.top - insets.bottom);
    }
  
    Rectangle2D dataArea = plotArea;
    if (info != null) {
        info.setDataArea(dataArea);
    }
   
    // draw the plot background and axes...
    drawBackground(g2, dataArea);
    double h = Math.min(dataArea.getWidth() / 2.0, dataArea.getHeight() / 2.0) - MARGIN;
    Rectangle2D quadrant = new Rectangle2D.Double(
        dataArea.getCenterX(), dataArea.getCenterY(), h, h
    );
    AxisState state = drawAxis(g2, plotArea, quadrant);
    if (this.renderer != null) {
        Shape originalClip = g2.getClip();
        Composite originalComposite = g2.getComposite();
      
        g2.clip(dataArea);
        g2.setComposite(
            AlphaComposite.getInstance(AlphaComposite.SRC_OVER, getForegroundAlpha())
        );
      
        drawGridlines(g2, dataArea, this.angleTicks, state.getTicks());
      
        // draw...
        render(g2, dataArea, info);
      
        g2.setClip(originalClip);
        g2.setComposite(originalComposite);
    }
    drawOutline(g2, dataArea);
    drawCornerTextItems(g2, dataArea);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:75,代码来源:PolarPlot.java

示例15: paintBase

import java.awt.Graphics2D; //导入方法依赖的package包/类
@Override
    protected void paintBase(Graphics2D g) {
        Rectangle r = this.getBounds();
        int esq = (int) (r.width * Criador.getDivisor());
        setArea(new Rectangle(esq -2, 0, 4, r.height - 1));

        //int dir = r.width - esq;
        if (!isSelecionado()) {
            g.setColor(Color.GRAY);
            g.drawRoundRect(0, 0, r.width - 1, r.height - 1, 10, 10);
            g.drawLine(esq, 0, esq, r.height - 1);

            g.setColor(Color.BLACK);
            
            getCorParaTexto(g);
            
            Rectangle bkp = g.getClipBounds();
            g.clipRect(0, 0, esq - 1, r.height);
            g.drawString(getTexto(), (Criador.espaco * 2) + 1, (int) (r.height * 0.72));

            g.setClip(bkp);
            int re = esq + r.height -5;
            g.setColor(CanEdit() ? Color.BLACK : Color.LIGHT_GRAY);
            g.fillRect(esq + 4, 4, r.height - 9, r.height - 9);
            try {
                Color c = util.Utilidades.StringToColor(getTransValor());//new Color(Integer.parseInt(getTransValor()));
                g.setColor(c);
            } catch (Exception e) {
            }
            Color tmpc = g.getColor();
            String bonito = Integer.toString(tmpc.getRed()) + ", " + Integer.toString(tmpc.getGreen()) + ", " +Integer.toString(tmpc.getBlue())+ ", " +Integer.toString(tmpc.getAlpha());
            
            if (CanEdit()) {
                g.fillRect(esq + 5, 5, r.height - 10, r.height -10);
            }
            
//            g.setColor(CanEdit() ? Color.BLACK : Color.LIGHT_GRAY);
//            g.drawRect(tmp + 4, 4, r.height - 9, r.height -9);
            
            g.clipRect(re, 0, esq - 1, r.height);
            
            getCorParaTexto(g);

            g.drawString(bonito, re + (Criador.espaco * 2) + 1, (int) (r.height * 0.72));

            g.setClip(bkp);

        } else {
            super.paintBase(g);
        }
    }
 
开发者ID:chcandido,项目名称:brModelo,代码行数:52,代码来源:InspectorItemCor.java


注:本文中的java.awt.Graphics2D.setClip方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。