Package java.awt.geom

Examples of java.awt.geom.RoundRectangle2D


        }

        g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha));
        g2.setColor(bgColor);

        RoundRectangle2D rect = new RoundRectangle2D.Double(0, 0, c.getWidth() - 1, c.getHeight() - 1, 24, 24);
        g2.fill(rect);

        Ellipse2D ellipse = new Ellipse2D.Double(-c.getWidth(),
                c.getHeight() / 3.0, c.getWidth() * 3.0,
                c.getHeight() * 2.0);
 
View Full Code Here


            g2.drawLine(-2, 0, -2, height);

            g2.drawLine(width, 0, width, height);
            g2.drawLine(width + 1, 0, width + 1, height);

            RoundRectangle2D roundCasing = new RoundRectangle2D.Double(0, 2, width, height - 4, width, width);
            Area area = new Area(casing);
            area.subtract(new Area(roundCasing));
            g2.fill(area);

            g2.translate(-trackBounds.x - 2, -trackBounds.y);
        } else {
            int width = trackBounds.width;
            int height = trackBounds.height - 4 + ANTI_WIDTH;

            g2.translate(trackBounds.x, trackBounds.y + 2);

            Rectangle2D casing = new Rectangle2D.Double(0, 0, width, height);
            g2.setColor(Color.BLACK);

            float alpha = 0.5f;
            Composite composite = g2.getComposite();
            if (composite instanceof AlphaComposite) {
                alpha *= ((AlphaComposite) composite).getAlpha();
            }
            g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha));
            g2.fill(casing);
            g2.setComposite(composite);

            g2.drawLine(0, -1, width, -1);
            g2.drawLine(0, -2, width, -2);

            g2.drawLine(0, height, width, height);
            g2.drawLine(0, height + 1, width, height + 1);

            RoundRectangle2D roundCasing = new RoundRectangle2D.Double(2, 0, width - 4, height, height, height);
            Area area = new Area(casing);
            area.subtract(new Area(roundCasing));
            g2.fill(area);

            g2.translate(-trackBounds.x, -trackBounds.y - 2);
View Full Code Here

            g2.translate(thumbBounds.x + 1, thumbBounds.y + 2);

            int width = thumbBounds.width - 3 + ANTI_WIDTH;
            int height = thumbBounds.height - 4;

            RoundRectangle2D casing = new RoundRectangle2D.Double(0, 0, width, height, width, width);
            g2.setColor(Color.BLACK);
            Paint paint = g2.getPaint();
            g2.setPaint(new GradientPaint(0, 0, new Color(0x818a9b), 0, height, new Color(0x3a4252)));
            g2.fill(casing);
            g2.setPaint(paint);

            Stroke stroke = g2.getStroke();
            g2.setStroke(new BasicStroke(2.0f));
            g2.draw(casing);
            g2.setStroke(stroke);

            g2.translate(-thumbBounds.x - 1, -thumbBounds.y - 2);
        } else {
            g2.translate(thumbBounds.x + 2, thumbBounds.y + 1);

            int width = thumbBounds.width - 4;
            int height = thumbBounds.height - 3 + ANTI_WIDTH;

            RoundRectangle2D casing = new RoundRectangle2D.Double(0, 0, width, height, height, height);
            g2.setColor(Color.BLACK);

            Paint paint = g2.getPaint();
            g2.setPaint(new GradientPaint(0, 0, new Color(0x818a9b), 0, height, new Color(0x3a4252)));
            g2.fill(casing);
View Full Code Here

   
    /**
     * @see Graphics#drawRoundRect(int, int, int, int, int, int)
     */
    public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) {
        RoundRectangle2D rect = new RoundRectangle2D.Double(x,y,width,height,arcWidth, arcHeight);
        draw(rect);
    }
View Full Code Here

   
    /**
     * @see Graphics#fillRoundRect(int, int, int, int, int, int)
     */
    public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) {
        RoundRectangle2D rect = new RoundRectangle2D.Double(x,y,width,height,arcWidth, arcHeight);
        fill(rect);
    }
View Full Code Here

        Point convertedPoint = SwingUtilities.convertPoint(c, rect.getLocation(), augmentedPanel);
        int x = convertedPoint.x;
        int y = convertedPoint.y;
        int substringStart = labelText.toLowerCase().indexOf(spotlightText.toLowerCase());
        int substringEnd = substringStart + spotlightText.length();
        RoundRectangle2D roundRectangle2D = new RoundRectangle2D.Double(xOffset + x + fontMetrics.charsWidth(labelText.substring(0, substringStart).toCharArray(), 0, substringStart), y,
                        fontMetrics.charsWidth(labelText.substring(substringStart, substringEnd).toCharArray(), 0, spotlightText.length()),
                        rect.getHeight(), rect.getHeight()/2, rect.getHeight()/2);
        return roundRectangle2D;
    }
View Full Code Here

        if (!isGradient) {
            g2.setColor(backgroundColor);
            g2.fillRoundRect(x, y, w, h, arc, arc);
        } else {
            RoundRectangle2D r = new RoundRectangle2D.Float(x, y, w, h, arc, arc);
            g2.setPaint(tp);
            g2.fill(r);
        }
        // ////////////////////////////////////////////////////////////////
View Full Code Here

   
       Graphics2D g2 = (Graphics2D)g;
       g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

       int radius = size / 3;
       RoundRectangle2D r = new RoundRectangle2D.Float(x, y, size-1, size-1, radius, radius );
      
       g2.setColor( new Color( 255, 255, 0, 127) );
       g2.fill(r);
      
       g2.setStroke( new BasicStroke(3));
View Full Code Here

   * @throws IOException if an I/O error occured.
   */
  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());
  }
View Full Code Here

   * @throws IOException if an I/O error occured.
   */
  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());
  }
View Full Code Here

TOP

Related Classes of java.awt.geom.RoundRectangle2D

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.