je cherche à développer le jeu billard ayant comme background un billard mais je nel'arrive pas dés que je commence à insérer les boules,batons!!!!
**************************************************
&&&&&
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 public class Panelfond extends javax.swing.JPanel { public Panelfond() { initComponents(); this.setSize(400,300); } public void paintComponent[/COLOR](Graphics g){ Dimension d=getSize(); ImageIcon imfond=new ImageIcon(new ImageIcon(getClass().getResource("billard.jpg")).getImage()); g.drawImage(imfond.getImage(),0 ,0,d.width,d.height,null); setOpaque(false); super.paintComponent(g); }
plzplz ou est l'erreur
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 public class Frame extends javax.swing.JFrame { Boule[] dessin={new Boule(220,200,"01",Color.BLUE),new Boule(260,200,"02",Color.ORANGE.brighter())}; Baton[] de={new Baton(230,280,260,300,100)}; public Frame() { setTitle("Billard B.M.Pique"); initComponents(); Panelfond f=new Panelfond(); this.getContentPane().add(f); // this.add(f,BorderLayout.CENTER); this.pack(); this.setVisible(true); } public void paint(Graphics g) { dessin[0].paint(g); dessin[1].paint(g); de[0].paint(g);} public static void main(String args[])throws IOException { Panelfond f=new Panelfond();
Partager