Projet_JAVA_PMT_STRI1A/JAVA/PROJET-PMT_STRI1A/src/gui/Background.java

34 lines
577 B
Java
Raw Normal View History

2019-05-25 15:22:20 +02:00
/**
*
*/
package gui;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.GridBagLayout;
import javax.swing.ImageIcon;
import javax.swing.JPanel;
/**
* @author nicolas
*
*/
public class Background extends JPanel{
private ImageIcon image;
public Background(String path) {
super();
//this.setLayout(new FlowLayout());
this.image=new ImageIcon(path);
}
public void setBackground(ImageIcon back) {
this.image=back;
}
public void paintComponent(Graphics gr) {
super.paintComponent(gr);
gr.drawImage(image.getImage(),0,0,this);
}
}