タイトル通りです。
eclipseでパワプロtitle.pdfを表示させたいのですが、表示されません。
おそらく、画像ファイルが正しいフォルダにないからだと思いますが、どこに画像を置いておけばいいのかが分かりません。
ワークスペースのいろんな場所にこのパワプロtitle.pdfを置いてみたんですが、ダメでした。
Java
1public class Main extends JFrame implements ActionListener { 2 public static void main(String args[]){ 3 Main frame1 = new Main("パワプロくん"); 4 frame1.setVisible(true); 5 } 6 7 Main(String title){ 8 this.setTitle(title); 9 this.setSize(1000, 700); 10 this.setLocationRelativeTo(null); 11 this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 12 13 JPanel pane1 = new JPanel(); 14 ImageIcon icon1 = new ImageIcon("パワプロtitle.pdf"); 15 JLabel label1 = new JLabel(icon1); 16 pane1.add(label1); 17 18 Container con = this.getContentPane(); 19 con.add(pane1); 20 }
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/01/26 07:20