【发布时间】:2020-04-26 11:53:47
【问题描述】:
【问题讨论】:
-
让我们知道您的尝试。你试过谷歌吗?
-
你在哪里从 HTTP、本地磁盘、ftp 读取图像?
-
您可以添加代码链接或发布一些带有您的问题的代码吗?此链接显示了一些关于提供minimal, reproducible example 的指南
【问题讨论】:
如果我没听错的话,你可以把一张图片拖放到你的IDE中,首先你可以创建一个新文件夹(右键点击项目然后new然后source folder,这是Eclipse的)然后看看我使用的是什么(如果您使用的是 Swing):
JLabel label = new JLabel("");
Image img = new ImageIcon(this.getClass().getResource("imageName.jpg")).getImage();
label.setIcon(new ImageIcon(img));
label.setBounds(15, -228, 688, 391);
frame.getContentPane().add(label);
【讨论】: