Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
このコマンドを使用して、画像アイコンを追加します。
iadd.setIcon(new ImageIcon(getClass().getResource("add.png"))); top.add(iadd);
しかし、私はその例外を受け取りました[スレッド「メイン」java.lang.NullPointerExceptionの例外]
nullpointerException を取得する可能性は初期化されiaddていません。
iadd
iadd.setIcon(new ImageIcon(getClass().getResource("add.png")));
またはラインで
top.add(iadd);
top初期化されていません。
top