哎,看来大家也对这个问题有疑问,不过我已经找到了好方法,现在贴出来,供大家参考: javax.swing.ImageIcon imageIconSource = new ImageIcon("cool.jpg");
java.awt.Image image = imageIconSource.getImage();
Image tempImage = image.getScaledInstance(100,100,Image.SCALE_DEFAULT);
ImageIcon imageIcon = new ImageIcon(tempImage);
javax.swing.JLabel photoView = new JLabel();
photoView.setIcon(imageIcon);这样,在photoView 处的图标就会显示为100x100的cool.jpg。
java.awt.Image image = imageIconSource.getImage();
Image tempImage = image.getScaledInstance(100,100,Image.SCALE_DEFAULT);
ImageIcon imageIcon = new ImageIcon(tempImage);
javax.swing.JLabel photoView = new JLabel();
photoView.setIcon(imageIcon);这样,在photoView 处的图标就会显示为100x100的cool.jpg。
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货