图片适应JLabel的大小

	ImageIcon icon = new ImageIcon(image);
	JLabel label = new JLabel();    icon.setImage(icon.getImage().getScaledInstance(reImgWidth,
	reImgHeight,Image.SCALE_DEFAULT));
	//reImgWidth 和 reImgHeight是Label的宽高
	label.setIcon(icon);	
    
发布了34 篇原创文章 · 获赞 22 · 访问量 8731

猜你喜欢

转载自blog.csdn.net/qq_41247335/article/details/104032072
今日推荐