1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
import javax.swing.*;
import java.awt.*;
import java.awt.image.*;
//import java.awt.Toolkit;
class Plateau extends JPanel{
public void paintComponent(Graphics g){
super.paintComponent(g);
int x=getWidth()/8;
int y=getHeight()/4;
System.out.println(x);
System.out.println(y);
g.setColor(Color.red);
g.fillRect(x,y,getHeight(),getHeight()/2);
for(int j=0;j<4;j++){
for(int i=0; i<8;i++){
g.setColor(Color.white);
g.fillOval(x,y,70,70);
g.translate(70, 0);
}
g.translate(-560,0);
g.translate(0,70);
}
ImageIcon imageIcon = new ImageIcon("Bill.jpg");
Image image = imageIcon.getImage();
//Toolkit toolkit = Toolkit.getDefaultToolkit();
//Image image=toolkit.getImage("Bille.jpg");
System.out.println(image.getWidth(null));
System.out.println(image.getHeight(null));
BufferedImage bufferedImage = new BufferedImage(image.getWidth(null), image.getHeight(null),BufferedImage.TYPE_INT_RGB );
Graphics gg = bufferedImage.createGraphics();
gg.drawImage(bufferedImage,83,141,null);
}
} |
Partager