Java 8 RoundRectangle2D - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 RoundRectangle2D class.

This code example shows how to use the following methods:getHeight, getWidth, getX, getY, getArcHeight
   */ 
  public void writeObject (final Object o, final ObjectOutputStream out)
          throws IOException
  { 
    final RoundRectangle2D rectangle = (RoundRectangle2D) o;
    out.writeDouble(rectangle.getX());
    out.writeDouble(rectangle.getY());
    out.writeDouble(rectangle.getWidth());
    out.writeDouble(rectangle.getHeight());
    out.writeDouble(rectangle.getArcWidth());
    out.writeDouble(rectangle.getArcHeight());
  } 
 
  /** 
   * Reads the object from the object input stream. 
   * 
   * @param in the object input stream from where to read the serialized data. 
   * @return the generated object. 
   * 
   * @throws IOException            if reading the stream failed. 
6
CodeRank
This code example shows how to use the following methods:getHeight, getWidth, getX, getY, getArcHeight
    { 
      throw new ObjectFactoryException("The given object is no java.awt.geom.Rectangle2D."); 
    } 
 
    final RoundRectangle2D rect = (RoundRectangle2D) o;
    final float x = (float) rect.getX();
    final float y = (float) rect.getY();
    final float w = (float) rect.getWidth();
    final float h = (float) rect.getHeight();
    final float aw = (float) rect.getArcWidth();
    final float ah = (float) rect.getArcHeight();
 
    setParameter("x", new Float(x));
    setParameter("y", new Float(y));
    setParameter("width", new Float(w));
    setParameter("height", new Float(h));
    setParameter("arcWidth", new Float(aw));
    setParameter("arcHeight", new Float(ah));
  } 
 
6
CodeRank
This code example shows how to use the following methods:getHeight, getWidth, getX, getY, getArcHeight
//        graphics.setColor(getStrokeColor()); 
//        graphics.drawRoundRect((int) Math.round(shape.getX()), (int) Math.round(shape.getY()), (int) Math.round(shape 
//                .getWidth()), (int) Math.round(shape.getHeight()), (int) Math.round(shape.getArcWidth()), (int) Math 
//                .round(shape.getArcHeight())); 
        graphics.setColor(getFillColor());
        graphics.fillRoundRect((int) Math.round(shape.getX()), (int) Math.round(shape.getY()), (int) Math.round(shape
                .getWidth()), (int) Math.round(shape.getHeight()), (int) Math.round(shape.getArcWidth()), (int) Math
                .round(shape.getArcHeight()));
        graphics.setColor(getStrokeColor());
        graphics.drawRoundRect((int) Math.round(shape.getX()), (int) Math.round(shape.getY()), (int) Math.round(shape
                .getWidth()), (int) Math.round(shape.getHeight()), (int) Math.round(shape.getArcWidth()), (int) Math
                .round(shape.getArcHeight()));
 
        graphics.setColor(oldColor);
    } 
 
    /** 
     * <p> 
     * Reloads diagram interchange information from contained <code>GraphNode</code>. 
     * </p> 
5
CodeRank
This code example shows how to use the following methods:setRoundRect
     */ 
    public RoundRectangle2D getRoundRectangle(V v)
    { 
        Rectangle2D frame = getRectangle(v);
        float arc_size = (float)Math.min(frame.getHeight(), frame.getWidth()) / 2;
        theRoundRectangle.setRoundRect(frame.getX(), frame.getY(),
                frame.getWidth(), frame.getHeight(), arc_size, arc_size);
        return theRoundRectangle;
    } 
     
    private static final GeneralPath thePolygon = new GeneralPath();
    /** 
     * Returns a regular <code>num_sides</code>-sided  
     * <code>Polygon</code> whose bounding  
     * box's width and height are defined by this instance's size and 
     * aspect ratio functions for this vertex. 
     * @param num_sides the number of sides of the polygon; must be >= 3. 
     */ 
    public Shape getRegularPolygon(V v, int num_sides)
    { 
4
CodeRank
This code example shows how to use the following methods:getBounds
        return marginBox.contains(x, y);
    } 
 
    public Point getLocation() {
        Point location = new Point();
        location.x = marginBox.getBounds().x;
        location.y = marginBox.getBounds().y;
        return location;
    } 
 
    public Point getAttachPoint() {
        return attachPoint;
    } 
 
    private void renderShape(Graphics2D g2) {
        g2.setPaint(( highlight) ? DIFF_HIGHLIGHT_FILL_COLOR : DIFF_FILL_COLOR );
        g2.fill(marginBox);
 
        g2.setPaint(DIFF_STROKE_COLOR);
        g2.draw(marginBox);
3
CodeRank
This code example shows how to use the following methods:setRoundRect
            int arcHeight) {
        if (this.roundRect == null) {
            this.roundRect = new RoundRectangle2D.Double(x, y, width, height, 
                    arcWidth, arcHeight);
        } else { 
            this.roundRect.setRoundRect(x, y, width, height, 
                    arcWidth, arcHeight);
        }         
    } 
 
    /** 
     * Sets the attributes of the reusable {@link Arc2D} object that is used by 
     * {@link #drawArc(int, int, int, int, int, int)} and  
     * {@link #fillArc(int, int, int, int, int, int)} methods. 
     *  
     * @param x  the x-coordinate. 
     * @param y  the y-coordinate. 
     * @param width  the width. 
     * @param height  the height. 
     * @param startAngle  the start angle in degrees, 0 = 3 o'clock. 
3
CodeRank
This code example shows how to use the following methods:setRoundRect
 
    private void paintBorderFocused( Graphics2D g, int x, int y, int width, int height ) {
        g.setRenderingHint( RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON );
        g.setColor( NimbusHelper.getFocusColor() );
//        rect.setRect( x + 0.6, y + 0.6, width - 1.2, height - 1.2 ); 
        rect.setRoundRect( x + 0.6, y + 0.6, width - 1.2, height - 1.2, arcExtOuter, arcExtOuter );
        area.add( new Area( rect ));
        rect.setRoundRect( x + 2, y + 2, width - 4, height - 4, arcExtInner, arcExtInner );
        area.subtract( new Area( rect ));
        g.fill( area );
    } 
} 
3
CodeRank
This code example shows how to use the following methods:setRoundRect
            int arcHeight) {
        if (this.roundRect == null) {
            this.roundRect = new RoundRectangle2D.Double(x, y, width, height, 
                    arcWidth, arcHeight);
        } else { 
            this.roundRect.setRoundRect(x, y, width, height, 
                    arcWidth, arcHeight);
        }         
    } 
 
    /** 
     * Sets the attributes of the reusable {@link Arc2D} object that is used by 
     * {@link #drawArc(int, int, int, int, int, int)} and  
     * {@link #fillArc(int, int, int, int, int, int)} methods. 
     *  
     * @param x  the x-coordinate. 
     * @param y  the y-coordinate. 
     * @param width  the width. 
     * @param height  the height. 
     * @param startAngle  the start angle in degrees, 0 = 3 o'clock. 
1
CodeRank
See Code Examples for Java 8 RoundRectangle2D Methods: