当前位置: 技术问答>java相关
菜鸟问题:在JPanel上显示一张图,最小化后再还原,图就没了
来源: 互联网 发布时间:2017-04-13
本文导语: Frame1文件很简单,就多了加载图片的函数和按钮响应函数 //加载图片的函数 public void loadPic(String picName) { ImageIcon img=new ImageIcon(picName); int pWidth=rightPanel.getWidth(); int pHeight=rightPanel.getHeight(); int mW...
Frame1文件很简单,就多了加载图片的函数和按钮响应函数
//加载图片的函数
public void loadPic(String picName)
{
ImageIcon img=new ImageIcon(picName);
int pWidth=rightPanel.getWidth();
int pHeight=rightPanel.getHeight();
int mWidth=img.getIconWidth() ;
int mHeight=img.getIconHeight() ;
int x,y;
int width,height;
if((mWidth
//加载图片的函数
public void loadPic(String picName)
{
ImageIcon img=new ImageIcon(picName);
int pWidth=rightPanel.getWidth();
int pHeight=rightPanel.getHeight();
int mWidth=img.getIconWidth() ;
int mHeight=img.getIconHeight() ;
int x,y;
int width,height;
if((mWidth