34 lines
577 B
Java
34 lines
577 B
Java
|
/**
|
||
|
*
|
||
|
*/
|
||
|
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);
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|