I need help about a graphic problem

Hello,

I don't understand why nothing appear in the window ( I suppose that it's a problem of variable).

thanck you to look at my code:

package fourmiliere;

import javax.swing.JFrame;

import javax.swing.*;

import java.awt.*;

import javax.swing.border.TitledBorder;

publicclass phasedejeuextends JFrame{

public phasedejeu(){

try{

jbInit();

}catch (Exception ex){

ex.printStackTrace();

}

this.setDefaultCloseOperation(EXIT_ON_CLOSE);

this.setLocation(100,100);

this.setSize(700,550);

this.setTitle("Simulation");

this.setVisible(true);

}

private JPanelDessin2 jPanel5 =new JPanelDessin2(this);

private Dimension dim = jPanel5.getSize() ;

privateint larg = dim.width ;

privateint haut = dim.height;

publicint getLarg(){

return larg;

}

publicvoid setLarg(int x){

larg=x;

}

publicint getHaut(){

return haut;

}

publicvoid setHaut(int y){

haut=y;

}

JPanel jPanel6 =new JPanel();

JPanel jPanel7 =new JPanel();

TitledBorder titledBorder1 =new TitledBorder("");

Icon tigerIcon =new ImageIcon("stop.gif");

JButton jButton1 =new JButton("",tigerIcon);

Icon stopIcon =new ImageIcon("lecture2.gif");

JButton jButton2 =new JButton("",stopIcon);

Icon fourmIcon =new ImageIcon("fourmis.gif");

}

package fourmiliere;

import java.awt.*;

import javax.swing.*;

publicclass JPanelDessin2extends JPanel{

private phasedejeu jeu;

publicint largeur ;

publicint hauteur ;

Image tete2,fourmiliere,texture;

public JPanelDessin2(phasedejeu paramJeu){

this.jeu=paramJeu;

this.largeur = jeu.getLarg();

this.hauteur = jeu.getHaut();

texture=Toolkit.getDefaultToolkit().getImage("herbe.32934.jpg");

tete2 = Toolkit.getDefaultToolkit().getImage("fourmi.jpg");

fourmiliere = Toolkit.getDefaultToolkit().getImage("DSC_4798 Anthill l.jpg");

try{

jbInit();

}catch (Exception ex){

ex.printStackTrace();

}

}

publicvoid paintComponent (Graphics g){

super.paintComponent(g);

this.setBackground(Color.white);

int x=largeur;int y=hauteur;

//g.drawImage(texture,0,0,1350,758,this);

g.drawImage(tete2,200,50,x,y,this);

//g.drawImage(fourmiliere,50,100,100,100,this);

}

privatevoid jbInit()throws Exception{

}

}

[5694 byte] By [wawawaa] at [2007-11-27 0:58:55]
# 1
You will get better help if you post Swing questions in the Swing forum: http://forum.java.sun.com/forum.jspa?forumID=57
DrLaszloJamfa at 2007-7-11 23:33:04 > top of Java-index,Java Essentials,Java Programming...