Java Drawrect, Fillrect , Clearrect , Draw3drect Ve Fill3drect
JAVA DRAWRECT
import javax.swing.JApplet;
import java.awt.*;
import javax.swing.*;
public class NewJApplet extends JApplet {
public void paint(Graphics g) {
super.paint(g);
int size = 200;
do {
g.drawRect(150 - size/2, 150 - size/2, size, size);
size = size - 20;
} while (size > 0);
}
}
import java.awt.*;
import javax.swing.*;
public class NewJApplet extends JApplet {
public void paint(Graphics g) {
super.paint(g);
int size = 200;
do {
g.drawRect(150 - size/2, 150 - size/2, size, size);
size = size - 20;
} while (size > 0);
}
}
JAVA FİLLRECT VE DRAWRECT
import java.applet.Applet;
import java.awt.*;
public class NewJApplet extends Applet {
public void paint(Graphics g)
{
g.setColor(new Color(255,0,0));
g.drawRect(5,10,50,50);
g.fillRect(60,60,60,60);
}
}
JAVA CLEARRECT
import javax.swing.JApplet;
import java.awt.*;
import java.applet.*;
public class NewJApplet extends JApplet {
public void paint(Graphics g){
int windowWidth = getWidth( );
int windowHeight = getHeight( );
g.setColor( Color.RED );
g.drawOval( 50, 50, 160, 150 );
g.clearRect( 85, 250, windowWidth, windowHeight );
g.drawOval( 150, 25, 170, 150 );
g.clearRect( 85, 250, windowWidth, windowHeight );
g.drawOval( 250, 25, 170, 150 );
}
}
import java.awt.*;
import java.applet.*;
public class NewJApplet extends JApplet {
public void paint(Graphics g){
int windowWidth = getWidth( );
int windowHeight = getHeight( );
g.setColor( Color.RED );
g.drawOval( 50, 50, 160, 150 );
g.clearRect( 85, 250, windowWidth, windowHeight );
g.drawOval( 150, 25, 170, 150 );
g.clearRect( 85, 250, windowWidth, windowHeight );
g.drawOval( 250, 25, 170, 150 );
}
}
JAVA DRAW3DRECT VE FİLL3DRECT
import javax.swing.JApplet;
import java.awt.Color;
import java.awt.Graphics;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class MainClass extends JPanel {
public void paint(Graphics g) {
g.setColor (Color.gray);
g.draw3DRect (25, 10, 50, 75, true);
g.draw3DRect (25, 110, 50, 75, false);
g.fill3DRect (100, 10, 50, 75, true);
g.fill3DRect (100, 110, 50, 75, false);
}
public static void main(String[] args) {
JFrame frame = new JFrame();
frame.getContentPane().add(new MainClass());
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(200, 200);
frame.setVisible(true);
}
}
JAVA FİLL3DRECT
public class NewJApplet extends Applet {
public void paint(Graphics g){
g.setColor(Color.green);
g.fill3DRect(10,150,50,100,true);
g.fill3DRect(100,200,50,50,true);
}
}
Merve Rogop
Yorumunuzu Ekleyin