Java Drawrect, Fillrect , Clearrect , Draw3drect Ve Fill3drect

advertisement
Java Drawrect, Fillrect , Clearrect , Draw3drect Ve Fill3drect
Java Drawrect, Fillrect , Clearrect , Draw3drect Ve
Fill3drect
DRAWRECT() KULLANIMI
package javaapplication22;
import
import
import
import
import
java.awt.Color;
java.awt.Graphics;
javax.swing.JApplet;
java.awt.Font;
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);
}
}
www.dersmax.com
Java Drawrect, Fillrect , Clearrect ,
Draw3drect Ve Fill3drect
1
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 NewJApplet
extends JApplet {
public void
paint(Graphics g) {
//Clearrect çizilen şeklin
www.dersmax.com
Java Drawrect, Fillrect , Clearrect ,
Draw3drect Ve Fill3drect
2
Java Drawrect, Fillrect , Clearrect , Draw3drect Ve Fill3drect
koordinatlarını
yazdığımızda istenilen
bölgeyi siler
g.fillOval(20, 20,
180, 180);
g.clearRect(50, 70,
120, 80);
}
}
DRAW3DRECT KULLANIMI
www.dersmax.com
Java Drawrect, Fillrect , Clearrect ,
Draw3drect Ve Fill3drect
3
Java Drawrect, Fillrect , Clearrect , Draw3drect Ve Fill3drect
package javaapplication22;
import
import
import
import
import
import
java.awt.Color;
java.awt.Dimension;
java.awt.Graphics;
javax.swing.JApplet;
java.awt.Font;
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(, , 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);
}
}
www.dersmax.com
Java Drawrect, Fillrect , Clearrect ,
Draw3drect Ve Fill3drect
4
Java Drawrect, Fillrect , Clearrect , Draw3drect Ve Fill3drect
DRAW3DRECT VE FİLL3DRECT’İN BİR ARADA KULLANILMASI
www.dersmax.com
Java Drawrect, Fillrect , Clearrect ,
Draw3drect Ve Fill3drect
5
Download