我使用IntelliJ一切正常,但当我将项目发送给我的朋友(他使用Eclipse)时,他无法运行它
这是Class JPanelImage 我认为(drawComponent)的重新定义是问题
protected void paintComponent(Graphics g) {
super.paintComponent(g);
try {
BufferedImage bImage = ImageIO.read(new File( image));
BufferedImage jImage ;
g.drawImage(bImage, 2, 2, (int) getSize().getWidth(), (int) getSize().getHeight(), this);
for(int k=0;k<joueurs.size();k++) {
jImage= ImageIO.read(new File(Graphiques.Pions[joueurs.get(k).getId()]));
System.out.println("Affichage des joueurs X:"+32*(int)(k%2) +" Y:"+ (getSize().getHeight()/2-40*(k/2)));
g.drawImage(jImage,32*(k%2), (int) getSize().getHeight()/2-40*(int)(k/2),28,40, this);
}
if(artefact!=null){
jImage= ImageIO.read(new File("./res/images/tresors/"+artefact.getElementArtefact()+".png"));
g.drawImage(jImage,60, 8,28,40, this);
}
if(zone!=null){
switch (zone.getTypeSelection()){
case 0:
setBorder(Graphiques.INACTIVE_BORDER);
break;
case 1:
setBorder(Graphiques.ACTIVE_BORDER_SELECTED);
break;
case 2:
setBorder(Graphiques.ACTIVE_BORDER_SHORE_HOVER);
break;
}
}
} catch (IOException e) {
e.printStackTrace();
}
}