gan, sekarang saya ingin bikin Gambar Piramid, tapi berbentuk gambar gann,, dan saya pikir - pikir ingin bikin Piramid dengan media aplikasi Java Gannn,,
1. Maka pertama -tama saya buka notped ++ gan.
2. Copas Coding dibawah ini gan,, ke notped ++,,
Source Code :
import java.awt.*;
import javax.swing.*;
public class DrawPolygons extends JFrame {
public DrawPolygons() {
super ("Menggambar Polygon");
setSize (400,300);
show();
}
public void paint(Graphics g) {
super.paint (g);
int xValues[] = {20,40,50,30,20,15};
int yValues[] = {50,50,60,80,80,60};
Polygon poly1 = new Polygon (xValues, yValues, 6); //(arrX, arrY, jumTitik)
g.drawPolygon (poly1);
int xValues2[] = {70,90,100,80,70,65,60};
int yValues2[] = {100,100,110,110,130,110,90};
g.drawPolyline (xValues2, yValues2, 7);
int xValues3[] = {120,140,150,190};
int yValues3[] = {40,70,80,60};
g.fillPolygon (xValues3, yValues3, 4);
Polygon poly2 = new Polygon();
poly2.addPoint (220,100);
poly2.addPoint (175,150);
poly2.addPoint (270,150);
g.fillPolygon (poly2);
}
public static void main (String args[]) {
DrawPolygons test = new DrawPolygons();
test.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
3. lalu simpan nama file ini dengan DrawPolygons.java
4. Kemudian di Komfile engan menggunakan CMD gann,,,
5. Selesai deh gan, bikin gambar Pirmaid di JAVA
Outputnya :
heheheheh,,, bercanda gannn,,,
Salam Sukses Gann,,,
0 comments:
:)) :)] ;)) ;;) :D ;) :p :(( :) :( :X =(( :-o :-/ :-* :| 8-} ~x( :-t b-( :-L x( =))
Post a Comment