このエラーを解決するには? 手動でも、別のパスを使用して解決策を見つけることができませんでした。絶対パスを使用してバッファリングされた画像に画像を読み込む方法を説明してください。
private BufferedImage[] image = new BufferedImage[9];
private int imageNo = 0;
private Boolean draw = false;
private int drawType;
private String [] realtivePath;
private String [] absolutePath;
//=============================================================================
public DrawPanel() {
int i,j;
absolutePath = new String[9];
realtivePath = new String []{"B_Pictures\\Burj Khalifa.jpg", "B_Pictures\\Taipei 101.jpg", "B_Pictures\\Willis Tower.jpg",
"B_Pictures\\Empire State Building.jpg", "B_Pictures\\Chrysler Building.jpg",
"B_Pictures\\Woolworth Building.jpg", "B_Pictures\\Met Life Tower.jpg",
"B_Pictures\\Singer Building.jpg", "B_Pictures\\Philadelphia City Hall.jpg"};
//======================================================================
for(i = 0;i < 9; i++)
{
absolutePath[i] = new File(realtivePath[i]).getAbsolutePath();
System.out.println("Path is: "+absolutePath[i]);
}
//=======================================================================
try {
for (j = 0; j < 9; j++) {
image[j] = ImageIO.read(new File(absolutePath[j])); //<-- can't read absolute path!
}
}catch (IOException e) {
e.printStackTrace();
//System.out.println("Error reading file");
}