List of usage examples for java.awt Graphics2D draw
public abstract void draw(Shape s);
From source file:MainClass.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setPaint(Color.black);/*from w w w .j ava2 s . com*/ g2.draw(shape); AffineTransform at = AffineTransform.getTranslateInstance(75, 75); g2.transform(at); g2.setPaint(Color.red); g2.draw(shape); }
From source file:Main.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; int w = getSize().width; int h = getSize().height; Arc2D arc = new Arc2D.Double(0.0, 0.5, w, h, 0.0, 60.0, Arc2D.CHORD); g2.draw(arc); arc.setArcByCenter(2, 3, w, h, 110.0f, Arc2D.PIE); g2.fill(arc);/*w w w . j a v a2s .c om*/ arc = new Arc2D.Float(0.0f, 0.0f, w, h, 210.0f, 130.0f, Arc2D.OPEN); g2.draw(arc); }
From source file:Main.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; int w = getSize().width; int h = getSize().height; Arc2D arc = new Arc2D.Double(0.0, 0.5, w, h, 0.0, 60.0, Arc2D.CHORD); g2.draw(arc); arc.setArc(0.0f, 0.0f, w, h, 80.0f, 110.0f, Arc2D.PIE); g2.fill(arc);//from w ww .j a va2 s . c om arc = new Arc2D.Float(0.0f, 0.0f, w, h, 210.0f, 130.0f, Arc2D.OPEN); g2.draw(arc); }
From source file:Main.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; int w = getSize().width; int h = getSize().height; Arc2D arc = new Arc2D.Double(0.0, 0.5, w, h, 0.0, 60.0, Arc2D.CHORD); g2.draw(arc); arc.setArc(new Rectangle(2, 3, w, h), 80.0f, 110.0f, Arc2D.PIE); g2.fill(arc);//from w ww. ja v a 2s . c o m arc = new Arc2D.Float(0.0f, 0.0f, w, h, 210.0f, 130.0f, Arc2D.OPEN); g2.draw(arc); }
From source file:Main.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; int w = getSize().width; int h = getSize().height; Arc2D arc = new Arc2D.Double(0.0, 0.5, w, h, 0.0, 60.0, Arc2D.CHORD); g2.draw(arc); arc.setArcByTangent(new Point(2, 3), new Point(3, 4), new Point(3, 4), Arc2D.PIE); g2.fill(arc);// w w w .j ava 2s . c om arc = new Arc2D.Float(0.0f, 0.0f, w, h, 210.0f, 130.0f, Arc2D.OPEN); g2.draw(arc); }
From source file:Main.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; int w = getSize().width; int h = getSize().height; Arc2D arc = new Arc2D.Double(0.0, 0.0, w, h, 0.0, 60.0, Arc2D.CHORD); g2.draw(arc); arc = new Arc2D.Float(0.0f, 0.0f, w, h, 80.0f, 110.0f, Arc2D.PIE); g2.fill(arc);//from w w w .ja v a2 s . com arc = new Arc2D.Float(0.0f, 0.0f, w, h, 210.0f, 130.0f, Arc2D.OPEN); g2.draw(arc); }
From source file:Main.java
public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; int w = getSize().width; int h = getSize().height; Arc2D arc = new Arc2D.Double(0.0, 0.5, w, h, 0.0, 60.0, Arc2D.CHORD); g2.draw(arc); arc.setArc(new Point(2, 3), new Dimension(w, h), 80.0f, 110.0f, Arc2D.PIE); g2.fill(arc);/* w ww . ja v a2 s. c o m*/ arc = new Arc2D.Float(0.0f, 0.0f, w, h, 210.0f, 130.0f, Arc2D.OPEN); g2.draw(arc); }
From source file:MainClass.java
public void paint(Graphics g) { Shape shape = new Rectangle2D.Float(100, 50, 80, 80); Graphics2D g2 = (Graphics2D) g; AffineTransform at = new AffineTransform(); at.setToRotation(Math.PI / 6); at.translate(100, 0);//from ww w . j av a 2 s . c o m g2.setTransform(at); g2.draw(shape); }
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.1F); g2.setStroke(stroke);/*w w w . j a va2s .c o m*/ g2.setPaint(Color.black); g2.draw(new Rectangle2D.Float(10, 10, 200, 200)); }
From source file:MainClass.java
public void paint(Graphics g) { Shape shape = new Rectangle2D.Float(100, 50, 80, 80); Graphics2D g2 = (Graphics2D) g; float cm = 72 / 2.54f; AffineTransform at = AffineTransform.getRotateInstance(-Math.PI / 6, 3 * cm, 2 * cm); g2.setTransform(at);/*from w ww.j a v a 2 s .co m*/ g2.draw(shape); }