List of usage examples for java.awt Graphics2D setStroke
public abstract void setStroke(Stroke s);
From source file:Main.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; Stroke stroke = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, new float[] { 3, 1 }, 0);/* w ww . j a v a2 s . c o m*/ g2.setStroke(stroke); g2.setPaint(Color.black); g2.draw(new Rectangle2D.Float(10, 20, 30, 40)); }
From source file:Main.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; Stroke stroke = new BasicStroke(10, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, new float[] { 3, 1 }, 0);// www .j a v a 2s. co m g2.setStroke(stroke); g2.setPaint(Color.black); g2.draw(new Rectangle2D.Float(10, 10, 200, 200)); }
From source file:QandE.XMarksTheSpot.java
protected void paintComponent(Graphics g) { if (isOpaque()) { g.setColor(getBackground());//from w ww. ja va2 s . c om g.fillRect(0, 0, getWidth(), getHeight()); g.setColor(getForeground()); } Graphics2D g2 = (Graphics2D) g; Insets insets = getInsets(); g2.setStroke(new BasicStroke(5.0f)); g2.draw(new Line2D.Double(insets.left, insets.top, getWidth() - insets.right, getHeight() - insets.bottom)); g2.draw(new Line2D.Double(insets.left, getHeight() - insets.bottom, getWidth() - insets.right, insets.top)); }
From source file:MainClass.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; Stroke stroke = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 0, new float[] { 3, 1 }, 0);/*w w w .ja va2s .com*/ g2.setStroke(stroke); g2.setPaint(Color.black); g2.draw(shape); }
From source file:LinesDashes3.java
public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; float[] dash3 = { 4f, 0f, 2f }; BasicStroke bs3 = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 1.0f, dash3, 2f); g2d.setStroke(bs3); g2d.drawLine(20, 60, 250, 60);/*from ww w . j av a 2 s. com*/ }
From source file:LinesDashes4.java
public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; float[] dash4 = { 4f, 4f, 1f }; BasicStroke bs4 = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 1.0f, dash4, 2f); g2d.setStroke(bs4); g2d.drawLine(20, 20, 250, 20);//from w w w. j a va 2 s . c o m }
From source file:com.rapidminer.gui.new_plotter.engine.jfreechart.PlotInstanceLegendCreator.java
private static Paint createTransparentCheckeredPaint(Color color, int checkerSize) { int s = checkerSize; BufferedImage bufferedImage = new BufferedImage(2 * s, 2 * s, BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = bufferedImage.createGraphics(); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, // Anti-alias! RenderingHints.VALUE_ANTIALIAS_ON); Color c1 = DataStructureUtils.setColorAlpha(color, (int) (color.getAlpha() * .8)); Color c2 = DataStructureUtils.setColorAlpha(color, (int) (color.getAlpha() * .2)); g2.setStroke(new BasicStroke(0)); g2.setPaint(c2);/*w w w. j a v a 2s . co m*/ g2.setColor(c2); g2.fillRect(0, 0, s, s); g2.fillRect(s, s, s, s); g2.setPaint(c1); g2.setColor(c1); g2.fillRect(0, s, s, s); g2.fillRect(s, 0, s, s); // paint with the texturing brush Rectangle2D rect = new Rectangle2D.Double(0, 0, 2 * s, 2 * s); return new TexturePaint(bufferedImage, rect); }
From source file:LinesDashes2.java
public void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; g2d.drawLine(20, 40, 250, 40);//from w ww .j a va2 s .c o m float[] dash2 = { 1f, 1f, 1f }; BasicStroke bs2 = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND, 1.0f, dash2, 2f); g2d.setStroke(bs2); g2d.drawLine(20, 20, 250, 20); }
From source file:net.sf.mzmine.modules.visualization.tic.TICPlotRenderer.java
protected void drawFirstPassShape(Graphics2D g2, int pass, int series, int item, Shape shape) { g2.setComposite(makeComposite(transparency)); g2.setStroke(getItemStroke(series, item)); g2.setPaint(getItemPaint(series, item)); g2.draw(shape);/*from ww w . j a v a2 s. c om*/ }
From source file:org.evors.rs.unibot.sim.SimulatedUnibot.java
@Override public void render(Graphics2D g2) { g2.setColor(new Color(45, 45, 45)); g2.fill(getShape().toJava2DShape()); g2.setStroke(bstroke); g2.setColor(Color.RED);/* w ww . ja v a 2 s. c om*/ g2.draw(getShortenedRangeFinderLine().toLine2D()); }