List of usage examples for java.awt Graphics2D draw
public abstract void draw(Shape s);
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);/*from w w w . j ava 2s . com*/ g2.setStroke(stroke); g2.setPaint(Color.black); g2.draw(new Rectangle2D.Float(10, 10, 200, 200)); }
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); arc.setAngles(0.4, 0.5, 0.6, 0.3);/*from ww w. j a v a2 s . c o m*/ g2.draw(arc); arc = new Arc2D.Float(0.0f, 0.0f, w, h, 80.0f, 110.0f, Arc2D.PIE); g2.fill(arc); 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); System.out.println(arc.hashCode()); g2.draw(arc); arc = new Arc2D.Float(0.0f, 0.0f, w, h, 80.0f, 110.0f, Arc2D.PIE); g2.fill(arc);//from w ww .j av a 2 s . co 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); arc.setAngleStart(new Point(3, 4)); g2.draw(arc); arc = new Arc2D.Float(0.0f, 0.0f, w, h, 80.0f, 110.0f, Arc2D.PIE); g2.fill(arc);//w w w. j a v a 2 s . co 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); arc.setAngleStart(new Point(3, 4)); g2.draw(arc); Arc2D arc1 = new Arc2D.Float(0.0f, 0.0f, w, h, 80.0f, 110.0f, Arc2D.PIE); arc.setArc(arc1);/*from w w w. j a v a 2 s . c o m*/ g2.fill(arc); 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); System.out.println(arc.getEndPoint()); g2.draw(arc); arc = new Arc2D.Float(0.0f, 0.0f, w, h, 80.0f, 110.0f, Arc2D.PIE); g2.fill(arc);/*from w ww .j a v a 2 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: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); System.out.println(arc.getBounds2D()); 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 .j av a2 s .co m arc = new Arc2D.Float(0.0f, 0.0f, w, h, 210.0f, 130.0f, Arc2D.OPEN); g2.draw(arc); }
From source file:ScreenCapture.java
public void paintComponent(Graphics g) { super.paintComponent(g); if (image != null) g.drawImage(image, 0, 0, this); if (startPoint.x != endPoint.x || startPoint.y != endPoint.y) { int x1 = (startPoint.x < endPoint.x) ? startPoint.x : endPoint.x; int y1 = (startPoint.y < endPoint.y) ? startPoint.y : endPoint.y; int x2 = (startPoint.x > endPoint.x) ? startPoint.x : endPoint.x; int y2 = (startPoint.y > endPoint.y) ? startPoint.y : endPoint.y; selectedRectangle.x = x1;//from w w w . ja v a2s.c o m selectedRectangle.y = y1; selectedRectangle.width = (x2 - x1) + 1; selectedRectangle.height = (y2 - y1) + 1; Graphics2D g2d = (Graphics2D) g; g2d.draw(selectedRectangle); } }
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); System.out.println(arc.getAngleStart()); 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.j av a2 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.0, w, h, 0.0, 60.0, Arc2D.CHORD); System.out.println(arc.contains(5, 6)); g2.draw(arc); arc = new Arc2D.Float(0.0f, 0.0f, w, h, 80.0f, 110.0f, Arc2D.PIE); g2.fill(arc);//from www . j a v a 2 s . c o m arc = new Arc2D.Float(0.0f, 0.0f, w, h, 210.0f, 130.0f, Arc2D.OPEN); g2.draw(arc); }