これは私がエラーを起こしているコードです:
pic = new ImageIcon("Koala.jpg");
picArr = ImageUtil.sliceImage(3, 3, pic);
for (int i = 0; i < picArr.length; i++){
leftbut[i].setIcon(new ImageIcon(picArr[i]));
}
これはエラーの正確な行です:
leftbut[i].setIcon(new ImageIcon(picArr[i]));
これはエラーです:
no suitable constructor found for ImageIcon(ImageIcon)
constructor ImageIcon.ImageIcon() is not applicable
(actual and formal argument lists differ in length)
constructor ImageIcon.ImageIcon(byte[]) is not applicable
(actual argument ImageIcon cannot be converted to byte[] by method invocation conversion)
constructor ImageIcon.ImageIcon(byte[],String) is not applicable
(actual and formal argument lists differ in length)
constructor ImageIcon.ImageIcon(Image) is not applicable
(actual argument ImageIcon cannot be converted to Image by method invocation conversion)
constructor ImageIcon.ImageIcon(Image,String) is not applicable
(actual and formal argument lists differ in length)
constructor ImageIcon.ImageIcon(URL) is not applicable
(actual argument ImageIcon cannot be converted to URL by method invocation conversion)
constructor ImageIcon.ImageIcon(URL,String) is not applicable
(actual and formal argument lists differ in length)
constructor ImageIcon.ImageIcon(String) is not applicable
(actual argument ImageIcon cannot be converted to String by method invocation conversion)
constructor ImageIcon.ImageIcon(String,String) is not applicable
(actual and formal argument lists differ in length)
追加情報 - leftbut.[i] は 9 つのボタンの配列であり、上記の方法を使用して 1 つの画像を 9 つのピースにスライスして、それぞれに imageicon を設定したい 助けてください。ありがとう!