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


Java Paint类代码示例

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


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

示例1: drawDomainMarker

import java.awt.Paint; //导入依赖的package包/类
/**
 * Draws a vertical line on the chart to represent a 'range marker'.
 *
 * @param g2  the graphics device.
 * @param plot  the plot.
 * @param domainAxis  the domain axis.
 * @param marker  the marker line.
 * @param dataArea  the axis data area.
 */
public void drawDomainMarker(Graphics2D g2,
                             ContourPlot plot,
                             ValueAxis domainAxis,
                             Marker marker,
                             Rectangle2D dataArea) {

    if (marker instanceof ValueMarker) {
        ValueMarker vm = (ValueMarker) marker;
        double value = vm.getValue();
        Range range = domainAxis.getRange();
        if (!range.contains(value)) {
            return;
        }
  
        double x = domainAxis.valueToJava2D(value, dataArea, RectangleEdge.BOTTOM);
        Line2D line = new Line2D.Double(x, dataArea.getMinY(), x, dataArea.getMaxY());
        Paint paint = marker.getOutlinePaint();
        Stroke stroke = marker.getOutlineStroke();
        g2.setPaint(paint != null ? paint : Plot.DEFAULT_OUTLINE_PAINT);
        g2.setStroke(stroke != null ? stroke : Plot.DEFAULT_OUTLINE_STROKE);
        g2.draw(line);
    }

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

示例2: drawDomainGridlines

import java.awt.Paint; //导入依赖的package包/类
/**
 * Draws the gridlines for the plot, if they are visible.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param ticks  the ticks.
 */
protected void drawDomainGridlines(Graphics2D g2, Rectangle2D dataArea,
                                   List ticks) {

    // no renderer, no gridlines...
    if (getRenderer() == null) {
        return;
    }

    // draw the domain grid lines, if any...
    if (isDomainGridlinesVisible()) {
        Stroke gridStroke = getDomainGridlineStroke();
        Paint gridPaint = getDomainGridlinePaint();
        if ((gridStroke != null) && (gridPaint != null)) {
            Iterator iterator = ticks.iterator();
            while (iterator.hasNext()) {
                ValueTick tick = (ValueTick) iterator.next();
                getRenderer().drawDomainGridLine(g2, this, getDomainAxis(),
                        dataArea, tick.getValue());
            }
        }
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:30,代码来源:XYPlot.java

示例3: CategoryLineAnnotation

import java.awt.Paint; //导入依赖的package包/类
/**
 * Creates a new annotation that draws a line between (category1, value1)
 * and (category2, value2).
 *
 * @param category1  the category (<code>null</code> not permitted).
 * @param value1  the value.
 * @param category2  the category (<code>null</code> not permitted).
 * @param value2  the value.
 * @param paint  the line color (<code>null</code> not permitted).
 * @param stroke  the line stroke (<code>null</code> not permitted).
 */
public CategoryLineAnnotation(Comparable category1, double value1, 
                              Comparable category2, double value2,
                              Paint paint, Stroke stroke) {
    if (category1 == null) {
        throw new IllegalArgumentException("Null 'category1' argument.");   
    }
    if (category2 == null) {
        throw new IllegalArgumentException("Null 'category2' argument.");   
    }
    if (paint == null) {
        throw new IllegalArgumentException("Null 'paint' argument.");   
    }
    if (stroke == null) {
        throw new IllegalArgumentException("Null 'stroke' argument.");   
    }
    this.category1 = category1;
    this.value1 = value1;
    this.category2 = category2;
    this.value2 = value2;
    this.paint = paint;
    this.stroke = stroke;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:34,代码来源:CategoryLineAnnotation.java

示例4: XYPolygonAnnotation

import java.awt.Paint; //导入依赖的package包/类
/**
 * Creates a new annotation.  The array of polygon coordinates must 
 * contain an even number of coordinates (each pair is an (x, y) location 
 * on the plot) and the last point is automatically joined back to the 
 * first point.
 *
 * @param polygon  the coordinates of the polygon's vertices 
 *     (<code>null</code> not permitted).
 * @param stroke  the shape stroke (<code>null</code> permitted).
 * @param outlinePaint  the shape color (<code>null</code> permitted).
 * @param fillPaint  the paint used to fill the shape (<code>null</code> 
 *                   permitted).
 */
public XYPolygonAnnotation(double[] polygon, 
                           Stroke stroke, 
                           Paint outlinePaint, Paint fillPaint) {
    if (polygon == null) {
        throw new IllegalArgumentException("Null 'polygon' argument.");
    }
    if (polygon.length % 2 != 0) {
        throw new IllegalArgumentException("The 'polygon' array must " 
                + "contain an even number of items.");
    }
    this.polygon = (double[]) polygon.clone();
    this.stroke = stroke;
    this.outlinePaint = outlinePaint;
    this.fillPaint = fillPaint;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:29,代码来源:XYPolygonAnnotation.java

示例5: drawRangeLine

import java.awt.Paint; //导入依赖的package包/类
/**
 * Utility method for drawing a line perpendicular to the range axis (used
 * for crosshairs).
 *
 * @param g2  the graphics device.
 * @param dataArea  the area defined by the axes.
 * @param value  the data value.
 * @param stroke  the line stroke (<code>null</code> not permitted).
 * @param paint  the line paint (<code>null</code> not permitted).
 */
protected void drawRangeLine(Graphics2D g2, Rectangle2D dataArea,
        double value, Stroke stroke, Paint paint) {

    double java2D = getRangeAxis().valueToJava2D(value, dataArea, 
            getRangeAxisEdge());
    Line2D line = null;
    if (this.orientation == PlotOrientation.HORIZONTAL) {
        line = new Line2D.Double(java2D, dataArea.getMinY(), java2D, 
                dataArea.getMaxY());
    }
    else if (this.orientation == PlotOrientation.VERTICAL) {
        line = new Line2D.Double(dataArea.getMinX(), java2D, 
                dataArea.getMaxX(), java2D);
    }
    g2.setStroke(stroke);
    g2.setPaint(paint);
    g2.draw(line);

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

示例6: equals

import java.awt.Paint; //导入依赖的package包/类
/**
 * Tests this map for equality with an arbitrary object.
 * 
 * @param obj  the object (<code>null</code> permitted).
 * 
 * @return A boolean.
 */
public boolean equals(Object obj) {
    if (obj == this) {
        return true;
    }
    if (!(obj instanceof PaintMap)) {
        return false;
    }
    PaintMap that = (PaintMap) obj;
    if (this.store.size() != that.store.size()) {
        return false;
    }
    Set keys = this.store.keySet();
    Iterator iterator = keys.iterator();
    while (iterator.hasNext()) {
        Comparable key = (Comparable) iterator.next();
        Paint p1 = getPaint(key);
        Paint p2 = that.getPaint(key);
        if (!PaintUtilities.equal(p1, p2)) {
            return false;
        }
    }
    return true;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:31,代码来源:PaintMap.java

示例7: drawDomainTickBands

import java.awt.Paint; //导入依赖的package包/类
/**
 * Draws the domain tick bands, if any.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param ticks  the ticks.
 */
public void drawDomainTickBands(Graphics2D g2, Rectangle2D dataArea, List ticks) {
    // draw the domain tick bands, if any...
    Paint bandPaint = getDomainTickBandPaint();
    if (bandPaint != null) {
        boolean fillBand = false;
        final ValueAxis xAxis = getDomainAxis();
        double previous = xAxis.getLowerBound();
        Iterator iterator = ticks.iterator();
        while (iterator.hasNext()) {
            ValueTick tick = (ValueTick) iterator.next();
            double current = tick.getValue();
            if (fillBand) {
                getRenderer().fillDomainGridBand(g2, this, xAxis, dataArea, previous, current);
            }
            previous = current;
            fillBand = !fillBand;
        }
        double end = xAxis.getUpperBound();
        if (fillBand) {
            getRenderer().fillDomainGridBand(g2, this, xAxis, dataArea, previous, end);
        }
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:31,代码来源:XYPlot.java

示例8: transform

import java.awt.Paint; //导入依赖的package包/类
@Override
public Paint transform(VirtualLink input) {
	if (vls.contains(input))
		return Color.CYAN;
	else
		return backupVL.get(input.getLayer()).transform(input);
}
 
开发者ID:KeepTheBeats,项目名称:alevin-svn2,代码行数:8,代码来源:MappingTreeSelectionListener.java

示例9: PinteNoArea

import java.awt.Paint; //导入依赖的package包/类
/**
 * Pinta a área que não será impressa
 */
private void PinteNoArea(Graphics2D Canvas) {
    if (getDiagrama() != null) {
        Paint bkp = Canvas.getPaint();
        Canvas.setColor(new Color(241, 241, 241));

        int x = PaginasW * LarguraPagina;
        Canvas.fillRect(x + 2, 2, getWidth() - (x + 4), getHeight() - 4);

        int y = PaginasH * AlturaPagina;
        Canvas.fillRect(2, y + 2, getWidth() - 4, getHeight() - (y + 4));
        Canvas.setPaint(bkp);
    }
}
 
开发者ID:chcandido,项目名称:brModelo,代码行数:17,代码来源:Impressor.java

示例10: setCompletePaint

import java.awt.Paint; //导入依赖的package包/类
/**
 * Sets the paint used to show the percentage complete and sends a {@link RendererChangeEvent}
 * to all registered listeners.
 * 
 * @param paint  the paint (<code>null</code> not permitted).
 */
public void setCompletePaint(Paint paint) {
    if (paint == null) {
        throw new IllegalArgumentException("Null paint not permitted.");
    }
    this.completePaint = paint;
    notifyListeners(new RendererChangeEvent(this));
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:14,代码来源:GanttRenderer.java

示例11: getBackgroundPaint

import java.awt.Paint; //导入依赖的package包/类
public Paint getBackgroundPaint(double width, double height) {
  if (this.isTransparentBackground()) {
    return null;
  }

  if (this.backgroundColor2 == null) {
    return this.backgroundColor1;
  }

  if (this.horizontalBackgroundGradient) {
    return new GradientPaint(0, 0, this.backgroundColor1, (float) (width / 2.0), 0, this.backgroundColor2);
  } else {
    return new GradientPaint(0, 0, this.backgroundColor1, 0, (float) (height / 2.0), this.backgroundColor2);
  }
}
 
开发者ID:gurkenlabs,项目名称:litiengine,代码行数:16,代码来源:Appearance.java

示例12: drawRangeTickBands

import java.awt.Paint; //导入依赖的package包/类
/**
 * Draws the range tick bands, if any.
 *
 * @param g2  the graphics device.
 * @param dataArea  the data area.
 * @param ticks  the ticks.
 * 
 * @see #setRangeTickBandPaint(Paint)
 */
public void drawRangeTickBands(Graphics2D g2, Rectangle2D dataArea,
                               List ticks) {

    // draw the range tick bands, if any...
    Paint bandPaint = getRangeTickBandPaint();
    if (bandPaint != null) {
        boolean fillBand = false;
        ValueAxis axis = getRangeAxis();
        double previous = axis.getLowerBound();
        Iterator iterator = ticks.iterator();
        while (iterator.hasNext()) {
            ValueTick tick = (ValueTick) iterator.next();
            double current = tick.getValue();
            if (fillBand) {
                getRenderer().fillRangeGridBand(g2, this, axis, dataArea, 
                        previous, current);
            }
            previous = current;
            fillBand = !fillBand;
        }
        double end = axis.getUpperBound();
        if (fillBand) {
            getRenderer().fillRangeGridBand(g2, this, axis, dataArea, 
                    previous, end);
        }
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:37,代码来源:XYPlot.java

示例13: setSeriesOutlinePaint

import java.awt.Paint; //导入依赖的package包/类
/**
 * Sets the series outline paint.
 *
 * @param series  the series index.
 * @param p  the paint.
 */
public void setSeriesOutlinePaint(int series, Paint p) {

    if ((series >= 0) && (series < this.seriesNeedle.length)) {
        this.seriesNeedle[series].setOutlinePaint(p);
    }

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

示例14: WaterfallBarRenderer

import java.awt.Paint; //导入依赖的package包/类
/**
 * Constructs a new waterfall renderer.
 *
 * @param firstBarPaint  the color of the first bar (<code>null</code> not 
 *                       permitted).
 * @param positiveBarPaint  the color for bars with positive values 
 *                          (<code>null</code> not permitted).
 * @param negativeBarPaint  the color for bars with negative values 
 *                          (<code>null</code> not permitted).
 * @param lastBarPaint  the color of the last bar (<code>null</code> not 
 *                      permitted).
 */
public WaterfallBarRenderer(Paint firstBarPaint, 
                            Paint positiveBarPaint, 
                            Paint negativeBarPaint,
                            Paint lastBarPaint) {
    super();
    if (firstBarPaint == null) {
        throw new IllegalArgumentException("Null 'firstBarPaint' argument");
    }
    if (positiveBarPaint == null) {
        throw new IllegalArgumentException(
            "Null 'positiveBarPaint' argument"
        );   
    }
    if (negativeBarPaint == null) {
        throw new IllegalArgumentException(
            "Null 'negativeBarPaint' argument"
        );   
    }
    if (lastBarPaint == null) {
        throw new IllegalArgumentException("Null 'lastBarPaint' argument");
    }
    this.firstBarPaint = firstBarPaint;
    this.lastBarPaint = lastBarPaint;
    this.positiveBarPaint = positiveBarPaint;
    this.negativeBarPaint = negativeBarPaint;
    setGradientPaintTransformer(
        new StandardGradientPaintTransformer(
            GradientPaintTransformType.CENTER_VERTICAL
        )
    );
    setMinimumBarLength(1.0);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:45,代码来源:WaterfallBarRenderer.java

示例15: WaterfallBarRenderer

import java.awt.Paint; //导入依赖的package包/类
/**
 * Constructs a new waterfall renderer.
 *
 * @param firstBarPaint  the color of the first bar.
 * @param positiveBarPaint  the color for bars with positive values.
 * @param negativeBarPaint  the color for bars with negative values.
 * @param lastBarPaint  the color of the last bar.
 */
public WaterfallBarRenderer(Paint firstBarPaint, 
                            Paint positiveBarPaint, 
                            Paint negativeBarPaint,
                            Paint lastBarPaint) {
    super();
    this.firstBarPaint = firstBarPaint;
    this.lastBarPaint = lastBarPaint;
    this.positiveBarPaint = positiveBarPaint;
    this.negativeBarPaint = negativeBarPaint;
    setGradientPaintTransformer(
        new StandardGradientPaintTransformer(GradientPaintTransformType.CENTER_VERTICAL));
    setMinimumBarLength(1.0);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:22,代码来源:WaterfallBarRenderer.java


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