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);
图片适应JLabel的大小
猜你喜欢
转载自blog.csdn.net/qq_41247335/article/details/104032072
今日推荐
周排行