1
我试图使用JLabel插入图像到我的GUI。但是它不会出现图片不出现
这里是部分我的代码
public FirstAid() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 700, 507);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(new BorderLayout(0, 0));
tabbedPane = new JTabbedPane(JTabbedPane.TOP);
contentPane.add(tabbedPane, BorderLayout.CENTER);
panel = new JPanel();
ImageIcon imageIcon = new ImageIcon("src/method_1.png");
JLabel label = new JLabel(imageIcon);
panel.add(label);
tabbedPane.addTab("name", null, panel, null);
您的编辑和添加的代码现在改变了整个问题(并使我的答案无效)。该代码和信息不应该是你的**原始问题**的一部分吗?此时,我建议您创建并发布[最小代码示例程序](http://stackoverflow.com/help/mcve)。 – 2015-02-08 14:59:51
然后我创建一个新问题吗? – friedrojak 2015-02-08 15:02:45
不,我的答案显然不是*答案,所以不要接受它,然后尝试在这里改进您当前的问题。 – 2015-02-08 15:05:40