Как разработка плагинов eclipse динамически загружает изображения в подключаемые модули?JAVA

Программисты JAVA общаются здесь
Ответить
Anonymous
 Как разработка плагинов eclipse динамически загружает изображения в подключаемые модули?

Сообщение Anonymous »

Now I create a new plug-in project, and there are icons/true.png and icons/ error-png images in the directory. Then I have a package in which I want to create an image array and load these two images. The following is my usage method:
public class TableViewerLabelProvider implements ITableLabelProvider {
private Image[] images = new Image[] { new Image(null,getClass().getResourceAsStream("/icons/true.png")),
new Image(null, getClass().getResourceAsStream("/icons/error.png")) };

}
При запуске программы сообщается о следующей ошибке:
!ENTRY org.eclipse.ui 4 0 2024-05-13 14:44:22.961
!MESSAGE Необработанное исключение цикла событий
!STACK 0
java.lang.IllegalArgumentException: Аргумент не может быть нулевым
в org.eclipse.swt.SWT.error(SWT.java: 4903)
в org.eclipse.swt.SWT.error(SWT.java:4837)
в org.eclipse.swt.SWT.error(SWT.java:4808)
в org .eclipse.swt.graphics.ImageLoader.load(ImageLoader.java:152)
в org.eclipse.swt.graphics.ImageDataLoader.load(ImageDataLoader.java:25)
в org.eclipse.swt .graphics.ImageData.(ImageData.java:334)
на org.eclipse.swt.graphics.Image.(Image.java:593)
на com.hinge.aptool.wizard.table.TableViewerLabelProvider . (TableViewerLabelProvider.java:8)
I tried to add the picture to the build path, but an error was reported,may I ask how to debug this, where to modify?


Подробнее здесь: https://stackoverflow.com/questions/784 ... in-modules
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «JAVA»