List of usage examples for java.awt Graphics2D setStroke
public abstract void setStroke(Stroke s);
From source file:org.jcurl.core.swing.CurvePainter.java
/** * Paint all curves of a store, delegate to * {@link #doPaint(Graphics2D, Iterator, double[], float, double[], double[], double[], double[])}. * // w ww . jav a 2 s . c om * @param g2 * where to draw * @param cs * store */ public void doPaint(final Graphics2D g2, final Iterable<Iterable<Entry<Double, R1RNFunction>>> cs) { g2.setStroke(stroke); int i = 0; for (final Iterable<Entry<Double, R1RNFunction>> name : cs) { if (log.isDebugEnabled()) log.debug("i=" + i + " " + (RockSet.isDark(i) ? "dark" : "light") + " " + RockSet.toIdx8(i)); g2.setPaint(RockSet.isDark(i++) ? dark : light); doPaint(g2, name.iterator(), sections, 1, t1, t2, t3, t4); } }
From source file:ec.util.chart.swing.JTimeSeriesRendererSupport.java
static void drawToolTip(Graphics2D g2, double x, double y, double anchorOffset, String label, Font font, Paint paint, Paint fillPaint, Paint outlinePaint, Stroke outlineStroke) { LabelBlock block = new LabelBlock(label/*.replace("\n", "")*/, font, paint); block.setMargin(3, 3, 3, 3);/* w w w .jav a 2s .c o m*/ Rectangle2D hotspot = createHotspot(g2, x, y, anchorOffset + 10, block.arrange(g2)); Shape shape = createShape(x, y, hotspot); if (fillPaint != null) { g2.setPaint(fillPaint); g2.fill(shape); } if (outlinePaint != null && outlineStroke != null) { g2.setStroke(outlineStroke); g2.setPaint(outlinePaint); g2.draw(shape); } block.draw(g2, hotspot); }
From source file:ShapeMover.java
public void update(Graphics g) { Graphics2D g2 = (Graphics2D) g; Dimension dim = getSize();/* w w w. jav a 2 s .com*/ int w = (int) dim.getWidth(); int h = (int) dim.getHeight(); g2.setStroke(new BasicStroke(8.0f)); if (isFirstTime) { area = new Rectangle(dim); rect.setLocation(w / 2 - 50, h / 2 - 25); isFirstTime = false; } // Clears the rectangle that was previously drawn. g2.setPaint(Color.white); g2.fillRect(0, 0, w, h); g2.setColor(Color.red); g2.draw(rect); g2.setColor(Color.black); g2.fill(rect); }
From source file:Main.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; RenderingHints rh = g2.getRenderingHints(); rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHints(rh);/* ww w . ja v a 2s. c om*/ BasicStroke bs = new BasicStroke(36.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL); g2.setStroke(bs); GeneralPath path = new GeneralPath(); path.moveTo(30.0f, 90.0f); path.lineTo(150.0f, 20.0f); path.lineTo(270.0f, 90.0f); g2.draw(path); }
From source file:Main.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; RenderingHints rh = g2.getRenderingHints(); rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHints(rh);//from w w w .ja va 2s . c o m BasicStroke bs = new BasicStroke(36.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER); g2.setStroke(bs); GeneralPath path = new GeneralPath(); path.moveTo(30.0f, 90.0f); path.lineTo(150.0f, 20.0f); path.lineTo(270.0f, 90.0f); g2.draw(path); }
From source file:Main.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; RenderingHints rh = g2.getRenderingHints(); rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHints(rh);/*ww w . j a v a 2s .c o m*/ BasicStroke bs = new BasicStroke(36.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND); g2.setStroke(bs); GeneralPath path = new GeneralPath(); path.moveTo(30.0f, 90.0f); path.lineTo(150.0f, 20.0f); path.lineTo(270.0f, 90.0f); g2.draw(path); }
From source file:MainClass.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; RenderingHints rh = g2.getRenderingHints(); rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHints(rh);// ww w . j a v a 2 s . co m BasicStroke bs = new BasicStroke(36.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER); g2.setStroke(bs); GeneralPath path = new GeneralPath(); path.moveTo(30.0f, 90.0f); path.lineTo(150.0f, 20.0f); path.lineTo(270.0f, 90.0f); g2.draw(path); }
From source file:MainClass.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; RenderingHints rh = g2.getRenderingHints(); rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHints(rh);//from w w w. java2s . c o m BasicStroke bs = new BasicStroke(36.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL); g2.setStroke(bs); GeneralPath path = new GeneralPath(); path.moveTo(30.0f, 90.0f); path.lineTo(150.0f, 20.0f); path.lineTo(270.0f, 90.0f); g2.draw(path); }
From source file:MainClass.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; RenderingHints rh = g2.getRenderingHints(); rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setRenderingHints(rh);//w ww .j av a 2s .c o m BasicStroke bs = new BasicStroke(36.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND); g2.setStroke(bs); GeneralPath path = new GeneralPath(); path.moveTo(30.0f, 90.0f); path.lineTo(150.0f, 20.0f); path.lineTo(270.0f, 90.0f); g2.draw(path); }
From source file:BasicDraw.java
public void paint(Graphics g) { Graphics2D g2d = (Graphics2D) g; float strokeThickness = 5.0f; float miterLimit = 10f; float[] dashPattern = { 10f }; float dashPhase = 5f; BasicStroke stroke = new BasicStroke(strokeThickness, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, miterLimit, dashPattern, dashPhase); g2d.setStroke(stroke); g2d.draw(new Rectangle(20, 20, 200, 200)); }