Java Drawrect, Fillrect , Clearrect , Draw3drect Ve Fill3drect

DRAWRECT() KULLANIMI

public void paint(Graphics g) {
       
   

   //Drawrect javada içi boş kutular çizmemizi sağlıyor.
       
        int size = 200;

      do {

         g.drawRect(150 - size/2, 150 - size/2, size, size);
         size = size - 20;

      } while (size > 0);
}
}
 
 

 Java drawRect, fillRect , clearRect , draw3DRect ve fill3DRect

FİLLRECT() KULLANIMI

 

package javaapplication22;

import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JApplet;
import java.awt.Font;
import java.awt.Graphics2D;

public class NewJApplet1 extends JApplet {

    public void paint(Graphics g) {


// Fillrect Javada kutu veya ne çizdiysek onun içini renklerle doldurmaya yarar.

 int dy = getSize().height;
        int dx = getSize().width;
        int mid_y = dy / 2;
        int mid_x = dx / 2;
        int rect_x = 3 * dx / 4;
        int rect_y = 3 * dy / 4;

          g.setColor(Color.BLACK);
          g.setColor(Color.LIGHT_GRAY);
          g.fillRect(mid_x - rect_x / 2 + 10, mid_y - rect_y / 2 + 10,rect_x - 20, rect_y - 20);
          g.setColor(Color.DARK_GRAY);
          g.drawOval(mid_x - rect_x / 6, mid_y - rect_y / 6,
                rect_x / 3, rect_y / 3);
          g.fillOval(mid_x - rect_x / 6 + 10, mid_y - rect_y / 6 + 10,
                rect_x / 3 - 20, rect_y / 3 - 20);
    }
}
 

Java Drawrect, Fillrect , Clearrect , Draw3drect Ve Fill3drect

 

DRAWRECT() VE FİLLRECT’İN BİR ARADA KULLANILMASI

 

package javaapplication22;

import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JApplet;

public class NewJApplet1 extends JApplet {

    public void paint(Graphics g) {




        int ai[] = {120, 30, 150, 70, 110, 10, 50};

        for (int x = 10, y = 250, i = 0; i < ai.length; ++i, x += 40) {
            g.setColor(Color.RED);
            g.fillRect(x, y - ai[i], 30, ai[i]);
            g.setColor(Color.black);
            g.drawRect(x, y - ai[i], 30, ai[i]);
        }
    }
}
 

 

 

Java Drawrect, Fillrect , Clearrect , Draw3drect Ve Fill3drect

CLEARRECT() KULLANIMI

 

package javaapplication22;

import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JApplet;

public class NewJApplet extends JApplet {

    public void paint(Graphics g) {

//Clearrect çizilen şeklin koordinatlarını yazdığımızda istenilen bölgeyi siler

        g.fillOval(20, 20, 180, 180);
        g.clearRect(50, 70, 120, 80);
    }
}
 

 

Java Drawrect, Fillrect , Clearrect , Draw3drect Ve Fill3drect

 

DRAW3DRECT KULLANIMI

 

package javaapplication22;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import javax.swing.JApplet;
import java.awt.Font;
import java.awt.Graphics2D;

public class NewJApplet1 extends JApplet {
   
    public void paint(Graphics g) {

//Javada yaptığımız kutu veya benzeri şekillere 3 boyutluluk özelliliği kazandırır.
   
    g.setColor(Color.blue);
   
    int thickness = 4;

    for (int i = 0; i <= thickness; i++)
      g.draw3DRect(100 - i, 10 - i, 60 + 2 * i, 30 + 2 * i, true);
    for (int i = 0; i < thickness; i++)
     
g.draw3DRect(100 - i, 50 - i, 60 + 2 * i, 30 + 2 * i, false);
for (int i = 0; i < thickness; i++)
    g.draw3DRect(100 - i, 90 - i, 60 + 2 * i, 30 + 2 * i, true);
    for (int i = 0; i < thickness; i++)
    g.draw3DRect(100 - i, 130 - i, 60 + 2 * i, 30 + 2 * i, true);
    for (int i = 0; i < thickness; i++)
   
 g.draw3DRect(100 - i, 170 - i, 60 + 2 * i, 30 + 2 * i, true);


  }

}
 

 

Java Drawrect, Fillrect , Clearrect , Draw3drect Ve Fill3drect

 

FİLL3DRECT KULLANIMI

 

package javaapplication22;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import javax.swing.JApplet;
import java.awt.Font;
import java.awt.Graphics2D;

public class NewJApplet1 extends JApplet {

    public void paint(Graphics g) {

      //Fill3Drect javada içi boyalı üç boyutlu kutu ya da kutular çizmemizi sağlar

  g.setColor(Color.GREEN);
        g.fillRect(0, 0, 1000, 1000);


        g.setColor(Color.RED);
        g.fill3DRect(100, 100, 100, 100, false);
        g.fillOval(400, 100, 100, 100);
        g.fill3DRect(600, 100, 100, 100, false);
        g.fill3DRect(900, 100, 50, 50, false);
        g.fill3DRect(800, 300, 100, 100, false);
        g.fill3DRect(550, 300, 100, 100, false);
        g.fill3DRect(250, 300, 100, 100, false);
        g.fillOval(10, 500, 100, 100);
        g.fill3DRect(225, 510, 50, 50, false);
        g.fill3DRect(450, 500, 100, 100, false);
        g.fill3DRect(750, 500, 250, 250, false);
        g.fill3DRect(120, 700, 75, 75, false);
        g.fillOval(450, 700, 200, 200);
        g.fill3DRect(250, 850, 50, 50, false);
        g.fill3DRect(850, 850, 50, 50, false);

    }
}
 

 

 

 

Java Drawrect, Fillrect , Clearrect , Draw3drect Ve Fill3drect

 

DRAW3DRECT VE FİLL3DRECT’İN BİR ARADA KULLANILMASI

 

 

package javaapplication22;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import javax.swing.JApplet;
import java.awt.Font;
import java.awt.Graphics2D;
       
public class NewJApplet1 extends JApplet {

    public void paint(Graphics g) {
 
        int x =20, y=20, gap=20,w=80,h=80;
        boolean raised=true;
        g.setColor(Color.YELLOW);
        for(int c=0;c<7;c++){
            g.draw3DRect(x+c,y+c,w-2*c,h-2*c, raised);
        g.draw3DRect(x+c+w+gap,y+c,w-2*c,h-2*c, !raised);
      g.fill3DRect(x+c+2*(w+gap),y+c,w-2*c,h-2*c, raised);
      g.fill3DRect(x+c+3*(w+gap),y+c,w-2*c,h-2*c,!raised);

        }
        }
    }
 

 

Java Drawrect, Fillrect , Clearrect , Draw3drect Ve Fill3drect

Mustafa CULHAOĞLU

Yorumunuzu Ekleyin

Matris Uygulaması
Çapraz yazı
Java Applet Fontlar
Yükleniyor...