SRC
SRC
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.image.BufferStrategy;
import java.awt.image.BufferedImage;
import javax.swing.JFrame;
public Game() {
this.setPreferredSize(new Dimension(WIDTH*SCALE,HEIGHT*SCALE));
initiFrame();
image = new BufferedImage(WIDTH, HEIGHT,BufferedImage.TYPE_INT_RGB);
}
public void initiFrame() {
frame = new JFrame("TELINHA DO GAME #1");
frame.add(this);
frame.setResizable(false);
frame.pack();
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
g.setColor(Color.yellow);
g.fillOval(0, 0, 30, 30);
g.setColor(Color.green);
g.fillRect(0, 80, 165, 70);
g.setColor(Color.white);
g.fillOval(120, 10, 30, 15);
g.setColor(Color.white);
g.fillOval(80, 10, 30, 15);
g.setColor(Color.white);
g.fillOval(40, 10, 30, 15);
g = bs.getDrawGraphics();
g.drawImage(image,0,0,WIDTH*SCALE,HEIGHT*SCALE,null);
bs.show();
}
}
}
}