さて、私はこのコードを以下に持っていますが、実行時エラーが発生し続けており、コードロジックの欠陥であると考えています. メソッドを使用しsetOneOtherPicture
て画像を選択し、それを配列に設定して、後で呼び出してshowArtCollection
メソッドに表示しようとしています。2 つのパラメーターが与えられましwhich
たpRef
。誰かがこれで私を助けることができますか? ありがとう。
public class House
{
String owner;
Picture pRef;
Picture favPic;
Picture [] picArray = new Picture [3];
public void showArtCollection ()
{
ArtWall aWall = new ArtWall(600,600);
aWall.copyPictureIntoWhere(favPic,250,100);
aWall.copyPictureIntoWhere(pRef,51,330);
aWall.copyPictureIntoWhere(pRef,151,330);
aWall.copyPictureIntoWhere(pRef,351,280);
aWall.show();
}
public void setOneOtherPicture (int which, Picture pRef)
{
this.picArray [which] = new Picture (FileChooser.pickAFile ());
}
public static void main (String [] args)
{
House PhDsHouse = new House ("Mad PH.D.");
Picture favPic = new Picture ();
Picture pRef = new Picture ();
PhDsHouse.setOneOtherPicture (0, pRef);
PhDsHouse.setOneOtherPicture (1, pRef);
PhDsHouse.setOneOtherPicture (2,pRef);
PhDsHouse.showArtCollection ();
}