JFrame 里如何加入 网络地址图片 如题,在JFrame 里。网络地址的图片是怎么添加的呀?!我新手,老是加不上去。谁能给我解解惑么?感激不尽 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我的代码 是这样的 : JFrame frame = new JFrame(); 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)); hibernate-mapping 如何映射关联查询中被关联表的字段? 调用hibernate操作报异常求解 struts+spring+hibernate整合时出现问题! java方面关于打印到excel文件或pdf文件的问题? sqlserver 查询过滤数据 Throwable 是否经常使用 tomcat5.0.16安装后无法启动。。。。。。。。。。。。。。。 各位大侠!!帮帮我好吗? 我现在很郁闷啊! 为什么getInputForward是null值? 后台判断是否需要显示加载更多按钮 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));