您的位置:首页 > 其它

JLabel 显示图片并自适应控件大小

2016-12-03 14:25 357 查看
static JLabel picture = new JLabel("New label"){
protected void paintComponent(Graphics g) {
ImageIcon icon = new ImageIcon("C:\\Users\\Administrator\\Desktop\\1.jpg");
g.drawImage(icon.getImage(), 0, 0, getWidth(),getHeight(),
icon.getImageObserver());
}
};
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息