Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import java.awt.event.*;
- import java.awt.geom.*;
- public class Chess extends Frame {
- public void paint(Graphics g) {
- Graphics2D graph = (Graphics2D)g;
- graph.setStroke(new BasicStroke(3f));
- int cnt = 0;
- for(int x = 100 ; x <=450 ; x+=50) {
- cnt++;
- for(int y = 100 ; y <=450 ; y+=50) {
- cnt++;
- Shape square = new Rectangle2D.Double(x, y,50,50);
- graph.draw(square);
- if(cnt % 2 == 0)
- graph.fill(square);
- }
- }
- }
- public static void main(String[] args) {
- Frame frame = new Chess();
- frame.addWindowListener(
- new WindowAdapter(){
- public void windowClosing(WindowEvent we){
- System.exit(0);
- }
- }
- );
- frame.setSize(1000, 1000);
- frame.setVisible(true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement