java.lang.illegalargumentexception参数不能为null swt

时间:2014-12-29 12:08:46

标签: java swt

我正在努力解决这个问题,有人可以帮我解决这个问题。提前致谢

  public void gui_OCM()
  {  
    Display d = new Display();
    Shell s = new Shell(d, SWT.CLOSE);

    s.setSize(550, 390);
    s.setText("My Application");
    s.setBackground(s.getDisplay().getSystemColor(10));

    InputStream is= getClass().getClassLoader().getResourceAsStream("resource/Hello.PNG")
    Image my_image= new Image(d,is);

它总是显示以下错误:

Exception in thread "main" java.lang.IllegalArgumentException: Argument cannot be null
    at org.eclipse.swt.SWT.error(Unknown Source)
    at org.eclipse.swt.SWT.error(Unknown Source)
    at org.eclipse.swt.SWT.error(Unknown Source)
    at org.eclipse.swt.graphics.ImageLoader.load(Unknown Source)
    at org.eclipse.swt.graphics.ImageDataLoader.load(Unknown Source)
    at org.eclipse.swt.graphics.ImageData.<init>(Unknown Source)
    at org.eclipse.swt.graphics.Image.<init>(Unknown Source)
    at ocm.OCM_GUI.gui_OCM(OCM_GUI.java:69)
    at ocm.OCM_GUI.main(OCM_GUI.java:405)

P.S:资源是我放置图像的文件夹 任何建议都会非常感激。感谢

0 个答案:

没有答案
相关问题