private static Ellipse2D.Double toOval(final Rectangle2D pRectangle) { Ellipse2D.Double ellipse = new Ellipse2D.Double(); ellipse.setFrame(pRectangle); return ellipse; }
private Ellipse2D.Double border = new Ellipse2D.Double(); … @Override public void paintComponent(Graphics g) { Graphics2D g2d = (Graphics2D) g; g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setPaint(Color.RED); g2d.fillRect(0, 0, width, height); border.setFrame(0, 0, width, height); g2d.setClip(border); g2d.drawImage(image, 0, 0, width, height, this); }
public static void drawCircle( Graphics2D g2 , double x , double y ,double r ) { Ellipse2D.Double c = new Ellipse2D.Double(); c.setFrame(x - r, y - r, 2 * r, 2 * r); g2.draw(c); } }
double x = topLeftX + CIRCLE_MARGIN + column * cellWidth; double y = topLeftY + CIRCLE_MARGIN + row * cellHeight; circle.setFrame(x,y,circleDiameter,circleDiameter); g2.setColor(fill); g2.fill(circle);
int w = getWidth() - 2 * N; int h = getHeight() - 2 * N; ball.setFrame(x, y, w, h); g2.setColor(currentColor); g2.fill(ball);
if ( s.vx >= 0 ) continue; ell.setFrame( s.x - s.r, s.y - s.r, s.r * 2, s.r * 2 ); if ( state == State.ANIM_ONLY ) g.setColor( s.color ); final RadialGradientPaint p = new RadialGradientPaint( new Point2D.Double( sun.x, sun.y ), radius, COL_DIST, COLORS ); g.setPaint( p ); ell.setFrame( sun.x - radius, sun.y - radius, radius * 2, radius * 2 ); g.fill( ell ); g.setPaint( storedPaint ); if ( s.vx < 0 ) continue; ell.setFrame( s.x - s.r, s.y - s.r, s.r * 2, s.r * 2 ); if ( state == State.ANIM_ONLY ) g.setColor( s.color );
myEllipse.setFrame( myEllipse.getX()+1, myEllipse.getY()+1, myEllipse.getWidth(), myEllipse.getHeight()); //Move 1 x-pixel and 1 y-pixel every 50 milliseconds repaint();
private void drawPoints(Graphics2D g2 ) { g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2.setStroke(new BasicStroke(3)); Ellipse2D.Double circle = new Ellipse2D.Double(); double r = 4; double w=r*2+1; for (int i = 0; i < points.length; i += 6) { p1.set(offX+points.data[i ],offY+points.data[i+1]); p2.set(offX+points.data[i+2],offY+points.data[i+3]); p3.set(offX+points.data[i+4],offY+points.data[i+5]); transform(affine1,p1); transform(affine2,p2); transform(affine3,p3); g2.setColor(colors[i/6]); circle.setFrame(p1.x-r,p1.y-r,w,w); g2.draw(circle); circle.setFrame(p2.x-r,p2.y-r,w,w); g2.draw(circle); circle.setFrame(p3.x-r,p3.y-r,w,w); g2.draw(circle); } }
public static void drawPoint( Graphics2D g2 , double x , double y ,double r, Color color , boolean hasBorder) { Ellipse2D.Double c = new Ellipse2D.Double(); double w = r*2; if( hasBorder ) { double r2 = r+2; double w2 = r2*2; g2.setColor(Color.BLACK); c.setFrame(x - r2, y - r2, w2, w2); g2.fill(c); } g2.setColor(color); c.setFrame(x - r, y - r, w, w); g2.fill(c); }
private Ellipse2D.Double border = new Ellipse2D.Double(); … public void paintComponent(Graphics g) { super.paintComponent() Graphics2D g2d = (Graphics2D) g; … int width = getWidth(); int height = getHeight(); g2d.setPaint(…); g2d.fillRect(0, 0, width, height); border.setFrame(0, 0, width, height); g2d.setClip(border); g2d.drawImage(image, 0, 0, width, height, this); }
public static void drawPoint( Graphics2D g2 , double x , double y ,double r, Color color , boolean hasBorder, Ellipse2D.Double c ) { double w = r*2; if( hasBorder ) { double r2 = r+2; double w2 = r2*2; g2.setColor(Color.BLACK); c.setFrame(x - r2, y - r2, w2, w2); g2.fill(c); } g2.setColor(color); c.setFrame(x - r, y - r, w, w); g2.fill(c); }
public static void drawPoint( Graphics2D g2 , double x , double y ,double r, Color colorInside , Color colorBorder, Ellipse2D.Double c ) { double w = r*2; double r2 = r+2; double w2 = r2*2; g2.setColor(colorBorder); c.setFrame(x - r2, y - r2, w2, w2); g2.fill(c); g2.setColor(colorInside); c.setFrame(x - r, y - r, w, w); g2.fill(c); }
/** * Sets the (x,y) position of the <code>Node</code>. * @param x The horizontal location. * @param y The vertical location. */ public void setPosition(int x, int y) { int w = getSize().width; int h = getSize().height; pos.x = x; pos.y = y; ellipse.setFrame(x - w / 2, y - h / 2, w, h); }
/** * Sets the <code>Node's</code> size. * @param width The width of the <code>Node</code>. * @param height The height of the <code>Node</code>. */ public void setSize(int width, int height) { int x = getPosition().x; int y = getPosition().y; ellipse.setFrame(x - width / 2, y - height / 2, width, height);//setLocation(x - width / 2, y - height / 2); //rect.setSize(width, height); }
public static void drawCircle( Graphics2D g2 , double x , double y ,double r ) { Ellipse2D.Double c = new Ellipse2D.Double(); c.setFrame(x - r, y - r, 2 * r, 2 * r); g2.draw(c); }
private static Ellipse2D.Double toOval(final Rectangle2D pRectangle) { Ellipse2D.Double ellipse = new Ellipse2D.Double(); ellipse.setFrame(pRectangle); return ellipse; }
private static Ellipse2D.Double toOval(final Rectangle2D pRectangle) { Ellipse2D.Double ellipse = new Ellipse2D.Double(); ellipse.setFrame(pRectangle); return ellipse; }
public static void drawCircle( Graphics2D g2 , double x , double y ,double r , Ellipse2D.Double c ) { c.setFrame(x - r, y - r, 2 * r, 2 * r); g2.draw(c); } }
public DiscArrow() { super(GraphGraphics.ARROW_DISC,1.0); // create the arrow final Ellipse2D.Double arrowE = new Ellipse2D.Double(); arrowE.setFrame(-1.0, -0.5, 1.0d, 1.0d); arrow = arrowE; // cap is calculated dynamically below! capGP = new GeneralPath(); capA = new Arc2D.Double(); currentRatio = Double.NaN; }