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.
シンプルなゲームImageIconを強化するために、Java Swingを使用しようとしています。Javaプロジェクトフォルダー内のEclipseワークスペースから相対ファイルパスを呼び出す方法を理解したいですか? 画像リソースの Eclipse で相対ファイルパスを実装するために使用できるコードは何ですか?
ImageIcon
Java
使用する:
getClass().getResource()
このようなもの:
jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images.jpg")));
imagesプロジェクトフォルダーにある場合。
images