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
| public class PanneauFenetre extends JPanel {
Image img;
Image img2;
public PanneauFenetre(){
try {
img = ImageIO.read (new File("boîte_logo.png"));
img2 = ImageIO.read(new File("logo_dico.png"));
} catch (IOException ex) {
Logger.getLogger(PanneauFenetre.class.getName()).log(Level.SEVERE, null, ex);
}
}
@Override
public void paintComponent(Graphics graph)
{
graph.drawRect(0,0,this.getWidth(), this.getHeight());
graph.setColor(getBackground());
graph.fillRect(0,0,this.getWidth(), this.getHeight());
graph.drawImage(img,15,10,(this.getWidth()*10)/100,(this.getWidth()*2)/100,this);
graph.drawImage(img2,(this.getWidth()*10)/100+20,10, (this.getWidth()*10)/100,(this.getWidth()*2)/100, this);
}
} |
Partager