Java Drawline Ve Setstroke Ve Drawoval, Filloval Kullanımı
Java drawline ve setstroke ve drawoval, filloval kullanımı
ARABA ÖRNEĞİ:
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JApplet;
public class NewJApplet extends JApplet {
public void init() {
}
public void paint(Graphics ekran) {
//ARABA
ekran.setColor(Color.BLACK );
ekran.fill3DRect(500, 200, 300, 70, false);
ekran.draw3DRect(570, 150,150,50,true);
ekran.drawLine(640,200,640,150);
ekran.setColor(Color.YELLOW );
ekran.fillOval(510, 270, 40, 40);
ekran.drawOval(510,270,40,40);
ekran.fillOval(750, 270, 40, 40);
ekran.drawOval(750,270,40,40);
}
}
sonuç:
GÖZLÜK ÖRNEĞİ:
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JApplet;
public class NewJApplet extends JApplet {
public void init() {
}
public void paint(Graphics ekran) {
ekran.setColor(Color.red);
ekran.drawLine(15, 10, 45, 145);
ekran.drawLine(250, 10, 291, 135);
ekran.setColor(Color.black);
ekran.fillOval(42, 90, 125, 85);
ekran.drawOval(166, 90, 125, 85);
}
}
import java.awt.Graphics;
import javax.swing.JApplet;
public class NewJApplet extends JApplet {
public void init() {
}
public void paint(Graphics ekran) {
ekran.setColor(Color.red);
ekran.drawLine(15, 10, 45, 145);
ekran.drawLine(250, 10, 291, 135);
ekran.setColor(Color.black);
ekran.fillOval(42, 90, 125, 85);
ekran.drawOval(166, 90, 125, 85);
}
}
sonuç:
Yorumunuzu Ekleyin