Java Draw Round Rectangle drawRoundRect(Graphics g, int x, int y, int w, int h)

Here you can find the source of drawRoundRect(Graphics g, int x, int y, int w, int h)

Description

draw Round Rect

License

Apache License

Declaration

public static void drawRoundRect(Graphics g, int x, int y, int w, int h) 

Method Source Code

//package com.java2s;
/*//w w w  .  j a  va 2  s .com
 * Copyright 2005 Patrick Gotthardt
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import java.awt.*;

public class Main {
    public static void drawRoundRect(Graphics g, int x, int y, int w, int h) {
        drawRoundRect(g, x, y, w, h, 4, 4);
    }

    public static void drawRoundRect(Graphics g, int x, int y, int w,
            int h, int c1, int c2) {
        Graphics2D gfx = (Graphics2D) g;
        gfx.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                RenderingHints.VALUE_ANTIALIAS_ON);
        gfx.drawRoundRect(x, y, w, h, c1, c2);
        gfx.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                RenderingHints.VALUE_ANTIALIAS_DEFAULT);
    }
}

Related

  1. drawRoundRect3D(Graphics2D g, int x, int y, int width, int height, int radius)
  2. drawRoundedRect(Graphics g, int left, int top, int right, int bottom)
  3. drawRoundSelectorCorner(Graphics g, Color outline, Color body, int x, int y, int size)