package inutile;
import javax.swing.*;
import java.awt.*;

@SuppressWarnings("serial")
public class ImagesCartes extends JPanel{
	Color c;
	public ImagesCartes(Color c){
		this.c=c;
	}
	public static void main(String [] args){
		JFrame f=new JFrame();
		f.setSize(300,450);
		f.add(new ImagesCartes(Color.red));
		f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		f.setVisible(true);
	}
	public void paintComponent(Graphics g){
		g.setColor(Color.white);
		g.fillRect(0, 0, this.getWidth(), this.getHeight());
		g.setColor(Color.black);
		g.drawRect(10, 10, this.getWidth()-20, this.getHeight()-20);
		g.drawRect(15, 15, this.getWidth()-30, this.getHeight()/5);
		g.setColor(c);
		g.fillRect(16, 16, this.getWidth()-31, this.getHeight()/5-1);
		g.setColor(Color.black);
		String titre="Titre de propriété";
        Font font = new Font("Arial Black", Font.ROMAN_BASELINE, 14);
        g.setFont(font);
		FontMetrics fm=g.getFontMetrics();
		int n=fm.stringWidth(titre);
		System.out.println(n);
		g.drawString(titre, (int)(this.getWidth()/2-n/2), 40);
	}
}
