Komputer Grafik, DrawLine

import java.applet.*;
import java.awt.*;
import java.awt.Font;
import java.awt.Graphics;
  public class TUGAS1 extends Applet{
      public void paint(Graphics g){
          g.setColor(Color.blue);
          g.fillRect(0,0,1500,1000);
    g.setColor(Color.yellow);
    int k;
    for(k=0; k<12; k++);
    g.fillArc(100,20,80,80,0,360);//gambar matahari
                g.drawLine(95,55,75,55);
                g.drawLine(140,105,140,125);
                g.drawLine(140,15,140,0);
                g.drawLine(185,60,205,60);
                g.drawLine(105,35,85,25);
                g.drawLine(120,20,105,5);
                g.drawLine(100,80,80,90);
                g.drawLine(115,100,100,120);
                g.drawLine(175,5,160,20);
                g.drawLine(205,25,175,35);
                g.drawLine(205,90,175,80);
                g.drawLine(175,120,160,100);
    
    g.setColor(Color.green);//gambar pohon
              int a[]={30,40,50,60}; // batang */
              int b[]={450,300,300,450}; // daun */
              g.fillPolygon(a,b,4);
              g.setColor(Color.cyan);
              g.fillArc(-10,300,120,80,0,360);
              g.fillArc(-10,270,130,80,0,360);
              g.fillArc(-10,240,110,100,0,360);
              g.fillArc(0,210,60,90,0,360);
 
     int mobil;
     for(mobil=0; mobil<2; mobil++){
 
              g.fillRect(200*mobil+305,505,100,30);//membuat mobil
              g.drawOval(200*mobil+307,478,104,45);
              g.setColor(Color.white);
              g.fillRect(200*mobil+310,505,100,30);
              g.drawOval(200*mobil+310,480,100,45);
              g.fillArc(200*mobil+280,498,60,70,0,180);
              g.fillArc(200*mobil+385,498,60,70,0,180);
              g.setColor(Color.yellow);
              g.fillArc(200*mobil+418,501,23,23,0,80);
 
              g.setColor(Color.gray);
              g.fillArc(200*mobil+330,484,70,40,0,90);
              g.setColor(Color.black);
              g.fillArc(200*mobil+334,485,68,36,0,90);
              g.setColor(Color.gray);
              g.fillArc(200*mobil+320,484,70,40,90,90);
              g.setColor(Color.black);
              g.fillArc(200*mobil+323,485,68,36,90,90);
              g.setColor(Color.yellow);
              g.fillRect(200*mobil+358,485,10,18);
 
  int i;
  for(i=0; i<4; i++){
  g.setColor(Color.red);  
  g.drawOval(100*i+298,513,32,32);//pengulangan untuk ban warna merah
  g.fillOval(100*i+298,513,32,32);
 
  int y;
  for(y=0; y<4; y++){
  g.setColor(Color.black);
  g.drawOval(100*y+304,520,20,20);// pengulangan ban hitam
  g.fillOval(100*y+304,520,20,20);
 
  g.setColor(Color.black);// membuat jalan
  g.drawRect(0,500,1500,80);
  g.setColor(Color.blue);
 
  g.setColor(Color.white);//pembuatan jalan
  int z;
  for (z=0; z<10; z++){
  g.fillRect(120*z+150,540,60,10);
 
 

 
  Font f = new Font ("TimesRoman",Font.PLAIN, 18);
  g.setFont (f);
  g.drawString("Kelompok", 700, 50);
  g.drawString("Lailatul Mubarokah, 201343500038", 700, 100);
  g.drawString("Nurdin Kustianto, 201343500078", 700, 125);
  g.drawString("Wahyono, 201343500081", 700, 150);
  g.drawString("Ahmad Arfani, 201343500089", 700, 175);
  g.drawString("Nurohman, 201343500091", 700, 200);
 
 
} }
}
}
}
}

Post a Comment

0 Comments

MY POST

Cara mengatasi Temporary failure in name resolution