List of usage examples for java.awt Graphics2D setRenderingHints
public abstract void setRenderingHints(Map<?, ?> hints);
From source file:Main.java
/** * Restores anti-aliasing in the supplied graphics context to its original setting. * * @param rock the results of a previous call to {@link #activateAntiAliasing} or null, in * which case this method will NOOP. This alleviates every caller having to conditionally avoid * calling restore if they chose not to activate earlier. *//*from w w w . j a v a 2s. c om*/ public static void restoreAntiAliasing(Graphics2D gfx, Object rock) { if (rock != null) { gfx.setRenderingHints((RenderingHints) rock); } }
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); BasicStroke bs = new BasicStroke(36.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL); g2.setStroke(bs);/*from www . jav a 2 s. c o m*/ 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); BasicStroke bs = new BasicStroke(36.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER); g2.setStroke(bs);/*from w ww . j av a 2 s . com*/ 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); BasicStroke bs = new BasicStroke(36.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND); g2.setStroke(bs);/*from www. j a v a2s . c o m*/ 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); BasicStroke bs = new BasicStroke(36.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER); g2.setStroke(bs);/* w w w . j a v a2 s. co m*/ 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); BasicStroke bs = new BasicStroke(36.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL); g2.setStroke(bs);//from w w w . j a v a 2 s. c om 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); BasicStroke bs = new BasicStroke(36.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND); g2.setStroke(bs);/* w w w.j a va2s .co m*/ 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); int x = 40, y = 40; g.setColor(Color.red);/*from w w w . j av a2 s . co m*/ g.fillOval(x, y, 50, 50); Composite old = g2.getComposite(); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_IN)); g.setColor(Color.green); g.fillOval(x + 30, y + 30, 30, 30); g2.setComposite(old); g.setColor(Color.black); g.drawString("AlphaComposite.SRC_IN", x, y + 80); }
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); int x = 40, y = 40; g.setColor(Color.red);//from w ww.ja v a2 s . co m g.fillOval(x, y, 50, 50); Composite old = g2.getComposite(); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OUT)); g.setColor(Color.green); g.fillOval(x + 30, y + 30, 30, 30); g2.setComposite(old); g.setColor(Color.black); g.drawString("AlphaComposite.SRC_OUT", x, y + 80); }
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); int x = 40, y = 40; g.setColor(Color.red);//from w w w. java2 s . c o m g.fillOval(x, y, 50, 50); Composite old = g2.getComposite(); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER)); g.setColor(Color.green); g.fillOval(x + 30, y + 30, 30, 30); g2.setComposite(old); g.setColor(Color.black); g.drawString("AlphaComposite.SRC_OVER", x, y + 80); }