Java 类java.awt.Stroke 实例源码
项目:parabuild-ci
文件:StackedXYAreaRendererTests.java
/**
* Test that the equals() method distinguishes all fields.
*/
public void testEquals() {
StackedXYAreaRenderer r1 = new StackedXYAreaRenderer();
StackedXYAreaRenderer r2 = new StackedXYAreaRenderer();
assertEquals(r1, r2);
assertEquals(r2, r1);
r1.setShapePaint(new GradientPaint(1.0f, 2.0f, Color.yellow,
3.0f, 4.0f, Color.green));
assertFalse(r1.equals(r2));
r2.setShapePaint(new GradientPaint(1.0f, 2.0f, Color.yellow,
3.0f, 4.0f, Color.green));
assertTrue(r1.equals(r2));
Stroke s = new BasicStroke(1.23f);
r1.setShapeStroke(s);
assertFalse(r1.equals(r2));
r2.setShapeStroke(s);
assertTrue(r1.equals(r2));
}
项目:parabuild-ci
文件:XYPlot.java
/**
* Draws a domain crosshair.
*
* @param g2 the graphics target.
* @param dataArea the data area.
* @param orientation the plot orientation.
* @param value the crosshair value.
* @param axis the axis against which the value is measured.
* @param stroke the stroke used to draw the crosshair line.
* @param paint the paint used to draw the crosshair line.
*
* @since 1.0.4
*/
protected void drawDomainCrosshair(Graphics2D g2, Rectangle2D dataArea,
PlotOrientation orientation, double value, ValueAxis axis,
Stroke stroke, Paint paint) {
if (axis.getRange().contains(value)) {
Line2D line = null;
if (orientation == PlotOrientation.VERTICAL) {
double xx = axis.valueToJava2D(value, dataArea,
RectangleEdge.BOTTOM);
line = new Line2D.Double(xx, dataArea.getMinY(), xx,
dataArea.getMaxY());
}
else {
double yy = axis.valueToJava2D(value, dataArea,
RectangleEdge.LEFT);
line = new Line2D.Double(dataArea.getMinX(), yy,
dataArea.getMaxX(), yy);
}
g2.setStroke(stroke);
g2.setPaint(paint);
g2.draw(line);
}
}
项目:TrabalhoFinalEDA2
文件:mxGraphics2DCanvas.java
/**
*
*/
public Stroke createStroke(Map<String, Object> style)
{
double width = mxUtils
.getFloat(style, mxConstants.STYLE_STROKEWIDTH, 1) * scale;
boolean dashed = mxUtils.isTrue(style, mxConstants.STYLE_DASHED);
if (dashed)
{
float[] dashPattern = mxUtils.getFloatArray(style,
mxConstants.STYLE_DASH_PATTERN,
mxConstants.DEFAULT_DASHED_PATTERN, " ");
float[] scaledDashPattern = new float[dashPattern.length];
for (int i = 0; i < dashPattern.length; i++)
{
scaledDashPattern[i] = (float) (dashPattern[i] * scale * width);
}
return new BasicStroke((float) width, BasicStroke.CAP_BUTT,
BasicStroke.JOIN_MITER, 10.0f, scaledDashPattern, 0.0f);
}
else
{
return new BasicStroke((float) width);
}
}
项目:parabuild-ci
文件:Plot.java
/**
* Sets the stroke used to outline the plot area and sends a {@link PlotChangeEvent} to all
* registered listeners. If you set this attribute to <code>null<.code>, no outline will be
* drawn.
*
* @param stroke the stroke (<code>null</code> permitted).
*/
public void setOutlineStroke(Stroke stroke) {
if (stroke == null) {
if (this.outlineStroke != null) {
this.outlineStroke = null;
notifyListeners(new PlotChangeEvent(this));
}
}
else {
if (this.outlineStroke != null) {
if (this.outlineStroke.equals(stroke)) {
return; // nothing to do
}
}
this.outlineStroke = stroke;
notifyListeners(new PlotChangeEvent(this));
}
}
项目:parabuild-ci
文件:ClipPath.java
/**
* Constructor for ClipPath.
*
* @param xValue x coordinates of curved to be created
* @param yValue y coordinates of curved to be created
* @param fillPath whether the path is to filled
* @param drawPath whether the path is to drawn as an outline
* @param fillPaint the fill paint
* @param drawPaint the outline stroke color
* @param drawStroke the stroke style
* @param composite the composite rule
*/
public ClipPath(double[] xValue, double[] yValue, boolean fillPath, boolean drawPath,
Paint fillPaint, Paint drawPaint, Stroke drawStroke, Composite composite) {
this.xValue = xValue;
this.yValue = yValue;
this.fillPath = fillPath;
this.drawPath = drawPath;
this.fillPaint = fillPaint;
this.drawPaint = drawPaint;
this.drawStroke = drawStroke;
this.composite = composite;
}
项目:parabuild-ci
文件:CategoryPlot.java
/**
* 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.
* @param paint the line paint.
*/
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);
}
项目:parabuild-ci
文件:XYLineAnnotation.java
/**
* Creates a new annotation that draws a line from (x1, y1) to (x2, y2)
* where the coordinates are measured in data space (that is, against the
* plot's axes).
*
* @param x1 the x-coordinate for the start of the line.
* @param y1 the y-coordinate for the start of the line.
* @param x2 the x-coordinate for the end of the line.
* @param y2 the y-coordinate for the end of the line.
* @param stroke the line stroke (<code>null</code> not permitted).
* @param paint the line color (<code>null</code> not permitted).
*/
public XYLineAnnotation(double x1, double y1, double x2, double y2,
Stroke stroke, Paint paint) {
if (stroke == null) {
throw new IllegalArgumentException("Null 'stroke' argument.");
}
if (paint == null) {
throw new IllegalArgumentException("Null 'paint' argument.");
}
this.x1 = x1;
this.y1 = y1;
this.x2 = x2;
this.y2 = y2;
this.stroke = stroke;
this.paint = paint;
}
项目:parabuild-ci
文件:XYPolygonAnnotation.java
/**
* 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;
}
项目:VASSAL-src
文件:SelectionHighlighter.java
public void draw(GamePiece p, Graphics g, int x, int y, Component obs, double zoom) {
final Graphics2D g2d = (Graphics2D) g;
if (accept(p)) {
if (useImage) {
final int x1 = x - (int) (imagePainter.getImageSize().width * zoom / 2);
final int y1 = y - (int) (imagePainter.getImageSize().height * zoom / 2);
imagePainter.draw(g, x1, y1, zoom, obs);
}
else {
if (color == null || thickness <= 0) {
return;
}
final Shape s = p.getShape();
final Stroke str = g2d.getStroke();
g2d.setStroke(new BasicStroke(Math.max(1, Math.round(zoom * thickness))));
g2d.setColor(color);
final AffineTransform t = AffineTransform.getScaleInstance(zoom, zoom);
t.translate(x / zoom, y / zoom);
g2d.draw(t.createTransformedShape(s));
g2d.setStroke(str);
}
}
}
项目:QN-ACTR-Release
文件:PainterConvex2D.java
/**
* Draw a semi-trasparent area that is the filtered area
* @param g The graphic object
* @param filteredArea The filtered area
*/
public void drawFiltArea(Graphics2D g, Area filtArea) {
AffineTransform t = new AffineTransform();
t.scale(scale / 100, scale / 100);
AffineTransform t2 = new AffineTransform();
t2.translate(tran_x, tran_y);
filtArea.transform(t);
filtArea.transform(t2);
Stroke oldStro = g.getStroke();
Stroke stroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
g.setStroke(stroke);
g.setColor(Color.gray);
Composite oldComp = g.getComposite();
Composite alphaComp = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.3f);
g.setComposite(alphaComp);
g.fill(filtArea);
g.setComposite(oldComp);
g.setStroke(oldStro);
}
项目:parabuild-ci
文件:CategoryPlot.java
/**
* Draws the gridlines for the plot.
*
* @param g2 the graphics device.
* @param dataArea the area inside the axes.
* @param ticks the ticks.
*/
protected void drawRangeGridlines(Graphics2D g2, Rectangle2D dataArea, List ticks) {
// draw the range grid lines, if any...
if (isRangeGridlinesVisible()) {
Stroke gridStroke = getRangeGridlineStroke();
Paint gridPaint = getRangeGridlinePaint();
if ((gridStroke != null) && (gridPaint != null)) {
ValueAxis axis = getRangeAxis();
if (axis != null) {
Iterator iterator = ticks.iterator();
while (iterator.hasNext()) {
ValueTick tick = (ValueTick) iterator.next();
CategoryItemRenderer renderer1 = getRenderer();
if (renderer1 != null) {
renderer1.drawRangeGridline(
g2, this, getRangeAxis(), dataArea, tick.getValue()
);
}
}
}
}
}
}
项目:geomapapp
文件:MBTracks.java
public void draw(Graphics2D g) {
if(!plot)return;
Stroke stroke = g.getStroke();
g.setStroke( new BasicStroke( 1f/(float)map.getZoom() ));
if(enabled) {
g.setColor(Color.black);
} else {
g.setColor(new Color(120, 90, 60));
}
for( int k=0 ; k<cruises.size() ; k++) {
Vector t = ((MBCruise)cruises.get(k)).tracks;
for( int i=0 ; i<t.size() ; i++) {
((MBTrack)t.get(i)).draw(g);
}
}
if(enabled) {
drawSelectedCruise(g, Color.white);
drawSelectedTrack(g, cruiseColor);
}
g.setStroke(stroke);
}
项目:litiengine
文件:OvalOutlineParticle.java
@Override
public void render(final Graphics2D g, final Point2D emitterOrigin) {
final Point2D renderLocation = this.getLocation(emitterOrigin);
g.setColor(this.getColor());
Stroke oldStroke = g.getStroke();
g.setStroke(this.getStroke());
g.draw(new Ellipse2D.Double(renderLocation.getX(), renderLocation.getY(), this.getWidth(), this.getHeight()));
g.setStroke(oldStroke);
}
项目:ramus
文件:Options.java
public static Stroke getStroke(String name, Stroke defaultStroke) {
String val = getString(name);
if (val == null)
return defaultStroke;
ByteArrayInputStream is = new ByteArrayInputStream(
DatatypeConverter.parseHexBinary(val));
try {
return DataLoader.readStroke(is, new DataLoader.MemoryData());
} catch (IOException e) {// shell never happen
e.printStackTrace();
return null;
}
}
项目:parabuild-ci
文件:CyclicNumberAxis.java
/**
* The advance line is the line drawn at the limit of the current cycle,
* when erasing the previous cycle.
*
* @param stroke the stroke (<code>null</code> not permitted).
*/
public void setAdvanceLineStroke(Stroke stroke) {
if (stroke == null) {
throw new IllegalArgumentException("Null 'stroke' argument.");
}
this.advanceLineStroke = stroke;
}
项目:openjdk-jdk10
文件:Underline.java
void drawUnderline(Graphics2D g2d,
float thickness,
float x1,
float x2,
float y) {
Stroke saveStroke = g2d.getStroke();
g2d.setStroke(getStroke(thickness));
g2d.draw(new Line2D.Float(x1, y + shift, x2, y + shift));
g2d.setStroke(saveStroke);
}
项目:rapidminer
文件:DistributionPlotter.java
private JFreeChart createNumericalChart() {
JFreeChart chart;
XYDataset dataset = createNumericalDataSet();
// create the chart...
String domainName = dataTable == null ? MODEL_DOMAIN_AXIS_NAME : dataTable.getColumnName(plotColumn);
chart = ChartFactory.createXYLineChart(null, // chart title
domainName, // x axis label
RANGE_AXIS_NAME, // y axis label
dataset, // data
PlotOrientation.VERTICAL, true, // include legend
true, // tooltips
false // urls
);
DeviationRenderer renderer = new DeviationRenderer(true, false);
Stroke stroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND);
if (dataset.getSeriesCount() == 1) {
renderer.setSeriesStroke(0, stroke);
renderer.setSeriesPaint(0, Color.RED);
renderer.setSeriesFillPaint(0, Color.RED);
} else {
for (int i = 0; i < dataset.getSeriesCount(); i++) {
renderer.setSeriesStroke(i, stroke);
Color color = getColorProvider().getPointColor((double) i / (double) (dataset.getSeriesCount() - 1));
renderer.setSeriesPaint(i, color);
renderer.setSeriesFillPaint(i, color);
}
}
renderer.setAlpha(0.12f);
XYPlot plot = (XYPlot) chart.getPlot();
plot.setRenderer(renderer);
return chart;
}
项目:parabuild-ci
文件:PiePlot.java
/**
* Sets the base section stroke.
*
* @param stroke the stroke (<code>null</code> not permitted).
*
* @see #getBaseSectionOutlineStroke()
*/
public void setBaseSectionOutlineStroke(Stroke stroke) {
if (stroke == null) {
throw new IllegalArgumentException("Null 'stroke' argument.");
}
this.baseSectionOutlineStroke = stroke;
notifyListeners(new PlotChangeEvent(this));
}
项目:parabuild-ci
文件:DialValueIndicator.java
/**
* Sets the outline stroke.
*
* @param stroke the stroke (<code>null</code> not permitted).
*/
public void setOutlineStroke(Stroke stroke) {
if (stroke == null) {
throw new IllegalArgumentException("Null 'stroke' argument.");
}
this.outlineStroke = stroke;
notifyListeners(new DialLayerChangeEvent(this));
}
项目:parabuild-ci
文件:ThermometerPlot.java
/**
* Sets the stroke used to draw the thermometer outline.
*
* @param s the new stroke (null ignored).
*/
public void setThermometerStroke(Stroke s) {
if (s != null) {
this.thermometerStroke = s;
notifyListeners(new PlotChangeEvent(this));
}
}
项目:Pogamut3
文件:TimeTicsWidget.java
@Override
protected void
paintWidget() {
int secondsPerTick = 10;
int secTickHeight = 6;
Graphics2D g = getGraphics();
g.setColor(getForeground());
int ticksNum = (int) (totalTime / (1000 * secondsPerTick));
Stroke formerStroke = g.getStroke();
g.setStroke(lineStroke);
// draw main line
g.drawLine(0, 0, (int) (totalTime / TLWidget.zoomFactor), 0);
// draw ticks
for (int tick = 0; tick <= ticksNum; tick++) {
int x = tick * secondsPerTick * 1000 / TLWidget.zoomFactor;
g.drawLine(x, 0, x, majorTickHeight);
// draw label
String time = ((tick * secondsPerTick) / 60) + ":" + ((tick * secondsPerTick) % 60);
//g.drawString(time, x, majorTickHeight);
Rectangle2D r = g.getFontMetrics().getStringBounds(time, g);
g.drawString(time, x - (float)r.getWidth() * 0.5f, majorTickHeight + (float)(r.getHeight()));
// draw minor ticks, per seconds
int lastSecTick = (int) (totalTime / 1000 < (tick + 1) * secondsPerTick - 1 ? totalTime / 1000 : (tick+1) * secondsPerTick - 1);
for (int secTick = tick * secondsPerTick + 1; secTick <= lastSecTick; secTick++) {
int secX = secTick * 1000/TLWidget.zoomFactor;
g.drawLine(secX, 0, secX, secTickHeight);
}
}
g.setStroke(formerStroke);
}
项目:Pogamut3
文件:CurrentTimeWidget.java
@Override
protected void paintWidget() {
Graphics2D g = getGraphics();
Stroke formerStroke = g.getStroke();
g.setColor(Color.RED);
g.setStroke(lineStroke);
g.drawLine(0, 0, 0, height);
g.setStroke(formerStroke);
}
项目:parabuild-ci
文件:ContourPlot.java
/**
* Utility method for drawing a crosshair on the chart (if required).
*
* @param g2 The graphics device.
* @param dataArea The data area.
* @param value The coordinate, where to draw the line.
* @param stroke The stroke to use.
* @param paint The paint to use.
*/
protected void drawHorizontalLine(Graphics2D g2, Rectangle2D dataArea,
double value, Stroke stroke,
Paint paint) {
double yy = getRangeAxis().valueToJava2D(value, dataArea,
RectangleEdge.LEFT);
Line2D line = new Line2D.Double(dataArea.getMinX(), yy,
dataArea.getMaxX(), yy);
g2.setStroke(stroke);
g2.setPaint(paint);
g2.draw(line);
}
项目:parabuild-ci
文件:DefaultDrawingSupplier.java
/**
* Returns the next outline stroke in the sequence.
*
* @return The stroke.
*/
public Stroke getNextOutlineStroke() {
Stroke result = this.outlineStrokeSequence[
this.outlineStrokeIndex % this.outlineStrokeSequence.length];
this.outlineStrokeIndex++;
return result;
}
项目:parabuild-ci
文件:StandardLegend.java
/**
* Sets the stroke used to outline shapes and sends a {@link LegendChangeEvent} to all
* registered listeners.
*
* @param stroke the stroke (<code>null</code> not permitted).
*/
public void setShapeOutlineStroke(Stroke stroke) {
if (stroke == null) {
throw new NullPointerException("Null 'stroke' argument");
}
this.shapeOutlineStroke = stroke;
notifyListeners(new LegendChangeEvent(this));
}
项目:parabuild-ci
文件:SpiderWebPlot.java
/**
* Sets the base series stroke.
*
* @param stroke the stroke (<code>null</code> not permitted).
*/
public void setBaseSeriesOutlineStroke(Stroke stroke) {
if (stroke == null) {
throw new IllegalArgumentException("Null 'stroke' argument.");
}
this.baseSeriesOutlineStroke = stroke;
notifyListeners(new PlotChangeEvent(this));
}
项目:ramus
文件:LineStyleAttributePlugin.java
@Override
public TableCellEditor getTableCellEditor(final Engine engine,
final AccessRules rules, final Attribute attribute) {
final JComboBox box = new JComboBox();
box.setRenderer(comboBoxRenderer);
for (Stroke stroke : LineStyleChooser.getStrokes()) {
box.addItem(stroke);
}
return new DefaultCellEditor(box) {
private Pin pin;
@Override
public boolean stopCellEditing() {
if (box.getSelectedItem() instanceof Stroke) {
((Journaled) engine).startUserTransaction();
apply((BasicStroke) box.getSelectedItem(), pin);
return super.stopCellEditing();
}
return false;
}
@Override
public Component getTableCellEditorComponent(JTable table,
Object value, boolean isSelected, int row, int column) {
pin = (Pin) ((MetadataGetter) table).getMetadata();
return super.getTableCellEditorComponent(table, value,
isSelected, row, column);
}
};
}
项目:parabuild-ci
文件:LegendItem.java
/**
* Creates a legend item using a line.
*
* @param label the label (<code>null</code> not permitted).
* @param description the description (<code>null</code> permitted).
* @param toolTipText the tool tip text (<code>null</code> permitted).
* @param urlText the URL text (<code>null</code> permitted).
* @param line the line (<code>null</code> not permitted).
* @param lineStroke the line stroke (<code>null</code> not permitted).
* @param linePaint the line paint (<code>null</code> not permitted).
*/
public LegendItem(AttributedString label, String description,
String toolTipText, String urlText,
Shape line, Stroke lineStroke, Paint linePaint) {
this(label, description, toolTipText, urlText,
/* shape visible = */ false, UNUSED_SHAPE,
/* shape filled = */ false, Color.black,
/* shape outlined = */ false, Color.black, UNUSED_STROKE,
/* line visible = */ true, line, lineStroke, linePaint
);
}
项目:parabuild-ci
文件:PiePlot.java
/**
* Sets the base section stroke.
*
* @param stroke the stroke (<code>null</code> not permitted).
*/
public void setBaseSectionOutlineStroke(Stroke stroke) {
if (stroke == null) {
throw new IllegalArgumentException("Null 'stroke' argument.");
}
this.baseSectionOutlineStroke = stroke;
notifyListeners(new PlotChangeEvent(this));
}
项目:VASSAL-src
文件:ColoredBorder.java
public void draw(GamePiece p, Graphics g, int x, int y,
Component obs, double zoom) {
if (thickness > 0) {
if (c != null) {
// Find the border by outsetting the bounding box, and then scaling
// the shape to fill the outset.
final Shape s = p.getShape();
final Rectangle br = s.getBounds();
// Don't bother if the shape is empty.
if (!br.isEmpty()) {
final double xzoom = (br.getWidth()+1) / br.getWidth();
final double yzoom = (br.getHeight()+1) / br.getHeight();
final AffineTransform t = AffineTransform.getTranslateInstance(x,y);
t.scale(xzoom*zoom, yzoom*zoom);
final Graphics2D g2d = (Graphics2D) g;
final Stroke str = g2d.getStroke();
g2d.setStroke(
new BasicStroke(Math.max(1, Math.round(zoom*thickness))));
g2d.setColor(c);
g2d.draw(t.createTransformedShape(s));
g2d.setStroke(str);
}
}
else {
highlightSelectionBounds(p, g, x, y, obs, zoom);
}
}
// Draw any additional highlighters
for (Highlighter h : highlighters) {
h.draw(p, g, x, y, obs, zoom);
}
}
项目:brModelo
文件:PreAtributo.java
@Override
public void DoPaint(Graphics2D g) {
if (isAutosize()) {
int largura = g.getFontMetrics(getFont()).stringWidth(getTextoToDraw()) + getHeight() + 4 + 4;
if (getWidth() != largura) {
setStopRaize(true);
setWidth(largura);
setStopRaize(false);
needRecalPts = true;
calculePontos();
SendNotificacao(Constantes.Operacao.opResize);
setRegiao(null);
if (isSelecionado()) {
Reposicione();
}
ReSizedByAutoSize();
}
}
super.DoPaint(g);
Shape reg;
if (getDirecaoLigacao() == Direcao.Left) {
reg = new Ellipse2D.Float(getLeft(), getTop(), getHeight() - 1, getHeight() - 1);
} else {
reg = new Ellipse2D.Float(getLeft() + getWidth() - getHeight(), getTop(), getHeight() - 1, getHeight() - 1);
}
Stroke bkps = g.getStroke();
if (isOpcional()) {
g.setStroke(new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, new float[]{4, 2}, 0));
}
if (isIdentificador()) {
g.fill(reg);
} else {
g.draw(reg);
}
if (isOpcional()) {
g.setStroke(bkps);
}
}
项目:brModelo
文件:Forma.java
@Override
public void DoPaint(Graphics2D g) {
//g.draw(getSuperArea());
// if (isAtualizando()) {
// return;
// }
super.DoPaint(g);
PinteTexto(g);
//teste: g.drawString(Integer.toString(getListaDePontosLigados().size()), getLeft() + 5, getTop() + 15);
if (dragging && getMaster().getEditor().isMostrarDimensoesAoMover()) {
Stroke bkp = g.getStroke();
Paint bkpP = g.getPaint();
g.setStroke(new BasicStroke(
1f,
BasicStroke.CAP_ROUND,
BasicStroke.JOIN_ROUND,
2f,
new float[]{2f, 2f},
0f));
g.setPaint(Color.gray);
g.drawLine(0, getTop(), getMaster().getWidth(), getTop());
g.drawLine(getLeft(), 0, getLeft(), getMaster().getHeight());
Font bkpf = g.getFont();
Font f = getMaster().getFont();
g.setFont(new Font(f.getName(), Font.ITALIC, f.getSize() - 2));
g.drawString("[" + String.valueOf(getLeft()) + ","
+ String.valueOf(getTop()) + "]", getLeft() + 4, getTop() - 4);
g.setFont(bkpf);
g.setStroke(bkp);
g.setPaint(bkpP);
}
if (isOverMe()) {
DoPaintDoks(g);
}
}
项目:DicomViewer
文件:StrokeSelector.java
public void selectedValueFromDashArray(float[] dashArray) {
for (Stroke s : tab) {
float[] array = ((BasicStroke)s).getDashArray();
if (array != null && Arrays.equals(array, dashArray)) {
setSelectedValue(s);
break;
}
}
}
项目:parabuild-ci
文件:AbstractCategoryItemRenderer.java
/**
* Draws a grid line against the domain axis.
* <P>
* Note that this default implementation assumes that the horizontal axis is the domain axis.
* If this is not the case, you will need to override this method.
*
* @param g2 the graphics device.
* @param plot the plot.
* @param dataArea the area for plotting data (not yet adjusted for any 3D effect).
* @param value the Java2D value at which the grid line should be drawn.
*/
public void drawDomainGridline(Graphics2D g2,
CategoryPlot plot,
Rectangle2D dataArea,
double value) {
Line2D line = null;
PlotOrientation orientation = plot.getOrientation();
if (orientation == PlotOrientation.HORIZONTAL) {
line = new Line2D.Double(dataArea.getMinX(), value, dataArea.getMaxX(), value);
}
else if (orientation == PlotOrientation.VERTICAL) {
line = new Line2D.Double(value, dataArea.getMinY(), value, dataArea.getMaxY());
}
Paint paint = plot.getDomainGridlinePaint();
if (paint == null) {
paint = CategoryPlot.DEFAULT_GRIDLINE_PAINT;
}
g2.setPaint(paint);
Stroke stroke = plot.getDomainGridlineStroke();
if (stroke == null) {
stroke = CategoryPlot.DEFAULT_GRIDLINE_STROKE;
}
g2.setStroke(stroke);
g2.draw(line);
}
项目:parabuild-ci
文件:AbstractXYItemRenderer.java
/**
* Draws a grid line against the range axis.
*
* @param g2 the graphics device.
* @param plot the plot.
* @param axis the value axis.
* @param dataArea the area for plotting data (not yet adjusted for any
* 3D effect).
* @param value the value at which the grid line should be drawn.
*/
public void drawDomainGridLine(Graphics2D g2,
XYPlot plot,
ValueAxis axis,
Rectangle2D dataArea,
double value) {
Range range = axis.getRange();
if (!range.contains(value)) {
return;
}
PlotOrientation orientation = plot.getOrientation();
double v = axis.valueToJava2D(value, dataArea,
plot.getDomainAxisEdge());
Line2D line = null;
if (orientation == PlotOrientation.HORIZONTAL) {
line = new Line2D.Double(dataArea.getMinX(), v,
dataArea.getMaxX(), v);
}
else if (orientation == PlotOrientation.VERTICAL) {
line = new Line2D.Double(v, dataArea.getMinY(), v,
dataArea.getMaxY());
}
Paint paint = plot.getDomainGridlinePaint();
Stroke stroke = plot.getDomainGridlineStroke();
g2.setPaint(paint != null ? paint : Plot.DEFAULT_OUTLINE_PAINT);
g2.setStroke(stroke != null ? stroke : Plot.DEFAULT_OUTLINE_STROKE);
g2.draw(line);
}
项目:Mafia
文件:Pointer.java
public void render(Graphics2D g, Game game) {
int pointOneX = (int) (startX + (targetX - startX) * pointerStage);
int pointOneY = (int) (startY + (targetY - startY) * pointerStage);
Stroke oldStroke = g.getStroke();
int colorAlpha = (int) (255 - 255 * pointerStage);
if(isPrimaryPointer)
g.setColor(new Color(POINTER_PRIMARY_COLOR.getRed(), POINTER_PRIMARY_COLOR.getGreen(), POINTER_PRIMARY_COLOR.getBlue(), colorAlpha));
else
g.setColor(new Color(POINTER_SECONDARY_COLOR.getRed(), POINTER_SECONDARY_COLOR.getGreen(), POINTER_SECONDARY_COLOR.getBlue(), colorAlpha));
g.setStroke(new BasicStroke(POINTER_THINKNESS));
g.drawLine(pointOneX, pointOneY, (int) startX, (int) startY);
g.setStroke(oldStroke);
}
项目:parabuild-ci
文件:SymbolAxis.java
/**
* Draws the grid bands for the axis when it is at the top or bottom of
* the plot.
*
* @param g2 the graphics device.
* @param drawArea the area within which the chart should be drawn.
* @param plotArea the area within which the plot should be drawn (a
* subset of the drawArea).
* @param firstGridBandIsDark True: the first grid band takes the
* color of <CODE>gridBandPaint<CODE>.
* False: the second grid band takes the
* color of <CODE>gridBandPaint<CODE>.
* @param ticks a list of ticks.
*/
protected void drawGridBandsVertical(Graphics2D g2,
Rectangle2D drawArea,
Rectangle2D plotArea,
boolean firstGridBandIsDark,
List ticks) {
boolean currentGridBandIsDark = firstGridBandIsDark;
double xx = plotArea.getX();
double yy1, yy2;
//gets the outline stroke width of the plot
double outlineStrokeWidth;
Stroke outlineStroke = getPlot().getOutlineStroke();
if (outlineStroke != null && outlineStroke instanceof BasicStroke) {
outlineStrokeWidth = ((BasicStroke) outlineStroke).getLineWidth();
}
else {
outlineStrokeWidth = 1d;
}
Iterator iterator = ticks.iterator();
ValueTick tick;
Rectangle2D band;
while (iterator.hasNext()) {
tick = (ValueTick) iterator.next();
yy1 = valueToJava2D(tick.getValue() + 0.5d, plotArea,
RectangleEdge.LEFT);
yy2 = valueToJava2D(tick.getValue() - 0.5d, plotArea,
RectangleEdge.LEFT);
if (currentGridBandIsDark) {
g2.setPaint(this.gridBandPaint);
}
else {
g2.setPaint(Color.white);
}
band = new Rectangle2D.Double(xx + outlineStrokeWidth, yy1,
plotArea.getMaxX() - xx - outlineStrokeWidth, yy2 - yy1);
g2.fill(band);
currentGridBandIsDark = !currentGridBandIsDark;
}
g2.setPaintMode();
}
项目:incubator-netbeans
文件:DependencyGraphScene.java
Stroke getStroke(GraphEdge<I> e) {
return paintingProvider != null ? paintingProvider.getStroke(e.getSource(), e.getTarget()) : null;
}
项目:incubator-netbeans
文件:CodeFoldingSideBar.java
private void drawFoldLine(Graphics2D g2d, boolean active, int x1, int y1, int x2, int y2) {
Stroke origStroke = g2d.getStroke();
g2d.setStroke(getStroke(origStroke, active));
g2d.drawLine(x1, y1, x2, y2);
g2d.setStroke(origStroke);
}
项目:Tarski
文件:mxCellHandler.java
/**
* Returns the stroke used to draw the selection border. This implementation returns null.
*/
public Stroke getSelectionStroke() {
return null;
}