如题,在JFrame 里。网络地址的图片是怎么添加的呀?!我新手,老是加不上去。谁能给我解解惑么?感激不尽
解决方案 »
- 应该怎么写? 谢谢
- 请教下杭州建达科技面试的时候会问些什么问题
- 请问使用HibernateTemplate可以得到insert或update的记录数吗?
- 收购正则表达式一个
- ssh 初学 The requested resource (Servlet action is not available) is not available. 问题
- Web Services 如何上传大文件呀
- 求救:读写信用卡是否用同步方法?
- 请问jboss4.0.3sp1中如何配置部署才能实现表单认证?解决了,马上发分,不够可以加。
- 通过JDBC建立连接
- 要向公司老总力推java,请大家帮个忙。。。。
- JPA生成表问题
- google maps v3 本地缓存怎么做
frame.setLayout(null);
frame.setBounds(300, 180, 400, 280);
ImageIcon image = new ImageIcon("http://www.baidu.com/img/baidu_sylogo1.gif");
JLabel label = new JLabel(image);
label.setBounds(80, 30, 250, 120);
label.setSize(250, 160);
frame.add(label);
frame.setDefaultCloseOperation(2);
label.setVisible(true);
frame.setVisible(true);
URL url = null;
Image img = null;
try {
url = new URL("http://www.baidu.com/img/baidu_sylogo1.gif");
img = Toolkit.getDefaultToolkit().getImage(url);
} catch (Exception e) {
e.printStackTrace();
}
JLabel label2 = new JLabel();
label2.setIcon(new ImageIcon(img));