我想在android studio中添加我的java项目。我有很多references &在Android studio中添加了我的项目。将图像添加到Android Studio中的Java项目中?
现在我无法将资产添加到我的项目。所以,请帮我解决这个问题
由于提前
结构
CODE
this.trayIcon = new TrayIcon(ImageIO.read(this.getClass().getResourceAsStream("icon.png")));
this.trayIcon.setImageAutoSize(true);
this.trayIcon.setToolTip("Remot Server");
this.trayIcon.setPopupMenu(menu);
SystemTray.getSystemTray().add(this.trayIcon);
错误
Exception in thread "main" java.lang.IllegalArgumentException: input == null!
at javax.imageio.ImageIO.read(ImageIO.java:1348)
可能与:HTTP:/ /stackoverflow.com/questions/24661229/getresourceasstream-returning-null-despite-called-file-being-in-same-dir-as-clas –
感谢您的链接。它不适用于我 – user3467240
这是什么TrayIcon无论如何,为什么你需要如此复杂的方式与imputStreams? – RexSplode