您的位置:首页 > 其它

swing JLabel详解以及使用示例

2016-10-18 17:28 423 查看
//文件句柄
ImageIcon icon = new ImageIcon("D:\\img\\screenn.png");
//设置自适应jlabel大小 icon.setImage(icon.getImage().getScaledInstance((icon.getIconWidth()/4),
(icon.getIconHeight()/4), Image.SCALE_DEFAULT));
System.out.println(icon.getIconWidth()+"x"+icon.getIconHeight());
jlabel = new JLabel(" ");
jlabel.setIcon(icon);//设置图片
jlabel.setBounds(10, 10, 190, 330);//设置Jlabel的大小


引用的地址:http://outofmemory.cn/code-snippet/1121/swing-JLabel-explain-in-detail-yiji-usage-shili
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: