Home » » Menggambar 3D Rectangle di Java

Menggambar 3D Rectangle di Java

Posted by KEPOIN IT on Monday, November 7, 2011


Program sederhana berikut ini merupakan contoh program java untuk menampilkan atau menggambar 3D Rectangle (Kotak 3 dimensi) di Java. Fungsi yang digunakan adalah draw3DRect() dan fill3DRect().

Berikut ini screenshoot tampilannya:


Dan berikut ini programnya:





01
import java.awt.*;
02


03
import javax.swing.*;
04


05
public class Draw3DRect extends JFrame {
06


07
    public Draw3DRect() {
08


09
        super ("Menggambar kotak 3D");
10


11
        setSize (400,165);
12


13
        setVisible (true);
14


15
    }
16


17
    public void paint (Graphics g) {
18


19
        super.paint (g);
20


21
        g.setColor (Color.BLUE);
22


23
        g.draw3DRect (5, 40, 90, 55, true); //(x,y, width,height)
24


25
        g.fill3DRect (100, 40, 90, 55, false); //(x,y, width,height)
26


27
    }
28


29
    public static void main (String args[]) {
30


31
        Draw3DRect test = new Draw3DRect();
32


33
        test.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
34


35
    }
36


37
}

Thanks for reading & sharing KEPOIN IT

Previous
« Prev Post

1 comments:

  1. Menggambar 3D Rectangle Di Javakepoin It >>>>> Spam Detected! Link aktif otomatis terhapus!!!

    >>>>> Spam Detected! Link aktif otomatis terhapus!!!

    Menggambar 3D Rectangle Di Javakepoin It >>>>> Spam Detected! Link aktif otomatis terhapus!!!

    >>>>> Spam Detected! Link aktif otomatis terhapus!!!

    Menggambar 3D Rectangle Di Javakepoin It >>>>> Spam Detected! Link aktif otomatis terhapus!!!

    >>>>> Spam Detected! Link aktif otomatis terhapus!!!

    ReplyDelete

Cari Artikel

Paling Dilihat