Menggambar Round Rectangle di Java

Program sederhana berikut ini merupakan contoh program java untuk menampilkan atau menggambar rounded rectangle (Kotak lengkung) di Java. Fungsi yang digunakan adalah drawRoundRect().

import java.awt.*;
import javax.swing.*;

public class DrawRoundRect extends JFrame {

	public DrawRoundRect() {
		super ("Menggambar kotak lengkung");

		setSize (400,165);
		setVisible (true);
	}

	public void paint (Graphics g) {
		super.paint (g);

		g.setColor (Color.RED);
		g.drawRoundRect (5, 40, 90, 55, 50, 50); //(x,y, width,height,arcWidth,arcHeight)
		g.fillRoundRect (100, 40, 90, 55, 20, 20); //(x,y, width,height,arcWidth,arcHeight)
	}

	public static void main (String args[]) {
		DrawRoundRect test = new DrawRoundRect();
		test.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
	}
}

Tampilan program

0 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 50 votes, average: 0.00 out of 5 (0 votes, average: 0.00 out of 5)
You need to be a registered member to rate this post.
Loading ... Loading ...
Java Swing

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

7 Responses to “Menggambar Round Rectangle di Java”

Leave Comment

(required)

(required)


// Place This Code At The End Or After All Ad Zone Div Created