SWT 设置背景图片的问题
使用下面的方法为什么会抛出异常啊?sShell.setBackgroundImage(newImage(display,getClass().getResourceAsS...
使用下面的方法为什么会抛出异常啊?
sShell.setBackgroundImage(new Image(display, getClass().getResourceAsStream("E:/Documents and Settings/Administrator/桌面/thumb_350_200_20090729053441838.jpg")));
Exception in thread "main" java.lang.IllegalArgumentException: Argument cannot be null
at org.eclipse.swt.SWT.error(SWT.java:3865)
at org.eclipse.swt.SWT.error(SWT.java:3799)
at org.eclipse.swt.SWT.error(SWT.java:3770)
at org.eclipse.swt.graphics.ImageLoader.load(ImageLoader.java:128)
at org.eclipse.swt.graphics.ImageDataLoader.load(ImageDataLoader.java:22)
at org.eclipse.swt.graphics.ImageData.<init>(ImageData.java:331)
at org.eclipse.swt.graphics.Image.<init>(Image.java:541)
at com.his.Main.StartSys.createSShell(StartSys.java:87)
at com.his.Main.StartSys.<init>(StartSys.java:297)
at com.his.Main.StartSys.main(StartSys.java:301) 展开
sShell.setBackgroundImage(new Image(display, getClass().getResourceAsStream("E:/Documents and Settings/Administrator/桌面/thumb_350_200_20090729053441838.jpg")));
Exception in thread "main" java.lang.IllegalArgumentException: Argument cannot be null
at org.eclipse.swt.SWT.error(SWT.java:3865)
at org.eclipse.swt.SWT.error(SWT.java:3799)
at org.eclipse.swt.SWT.error(SWT.java:3770)
at org.eclipse.swt.graphics.ImageLoader.load(ImageLoader.java:128)
at org.eclipse.swt.graphics.ImageDataLoader.load(ImageDataLoader.java:22)
at org.eclipse.swt.graphics.ImageData.<init>(ImageData.java:331)
at org.eclipse.swt.graphics.Image.<init>(Image.java:541)
at com.his.Main.StartSys.createSShell(StartSys.java:87)
at com.his.Main.StartSys.<init>(StartSys.java:297)
at com.his.Main.StartSys.main(StartSys.java:301) 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询