58,446
社区成员
发帖
与我相关
我的任务
分享import javax.swing.ImageIcon;
import javax.swing.JButton;
import unused.imgVisible;
public class jpgpng extends JButton{
public jpgpng(String pngurl,int displayx,int displayy)
{
ImageIcon srcicon = new ImageIcon(pngurl);
//Image scaleImage = srcicon.getImage().getScaledInstance(60, 80,Image.SCALE_DEFAULT);
ImageIcon scaleIcon = new ImageIcon(new imgVisible()
.getScaledImage(srcicon.getImage(),displayx,displayy,1));
this.setIcon(scaleIcon);
this.setBounds(0, 0, displayx,displayy);
}
}
自己解决了,嘿嘿,结贴