pbm de -1 dans une applet
salut
j'ai programmer une applet dans la quelle je charge une image mon pbm est que l'image n'est pas charger (je fait un affichage de la largeur de l'image et il m'affiche -1) cad l'image n'est pas charger voici mon code
Code:
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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
public class GoodEveningApplet extends JApplet {
// Méthode appelée par le navigateur lorsque l'applet est chargée
public static String strURLBase = new String("http://localhost:8080/");
String strURL ="TestTomCat/Test";
String text= "test sur le transfer";
JTextField texte=new JTextField(50);
TextArea responseField;
JFileChooser files= new JFileChooser();
Panel messageFieldPanel = new Panel();
Button action = new Button("ok");
Image im=null;
String path="/Images/cat.jpg";
public void init (){
super.init();
this.setLayout(new BorderLayout());
this.add("North",texte);
this.add("South", action = new Button("ok"));
this.add("Center", responseField = new TextArea());
responseField.setEditable(false);
///im=getImage(getCodeBase(), "cat.jpg");
URL url1;
///url1 = new URL("file:/C:/Documents and Settings/Administrateur/Bureau/");
//im=this.getImage(url1,"cat.jpg");
///BufferedImage bufferedImage = new BufferedImage( im.getWidth(null), im.getHeight(null), BufferedImage.TYPE_INT_RGB );
im = this.getImage(getDocumentBase(),path);
System.out.println(im.getWidth(this));
///im=this.getToolkit().getImage(new URL("C:/Documents and Settings/Administrateur/Bureau"));
} |
l'image est al'interieur de Images et dans le meme repertoire de l'applet
aider mois svp
merci d'avance