AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Png not loading in eclipse3/13/2024 ![]() This is a plug-in project (to simplify the class path creation) and can be loaded in either Eclipse 4.3 or 4.4.įor Eclipse 4. Thanks to Dennis John for finding the problem in the first place with ImageIcon i new ImageIcon ( 'C:/character.png' ). png classes into the org/eclipse/jface/dialogs/images directory so they can be loaded by the fallback you are running your app on your mac, but your image path is a windows path. There are two possible solutions I can think of:ġ. The root folder has the src folder and the bin folder. png variants, with the result that the message is not loaded. Try ImageIcon im new ImageIcon (new File ('banner.png')) If youre using eclipse, put it in the root folder, not the src folder. In this case, the image is being loaded from a different directory specifically, under the class name org/eclipse/jface/dialogs/images:Īs you can see, this only contains the. URL resource = location.getResource(name) However, the fallback case uses Class.getResource which uses the class name of the loading component: gif (for compatibility, presumably) as well as. ![]() The images (that are loaded for the OSGi case) come from the ICONS_PATH, which is icons/full/ in the bundle:Īs you can see, this has both. The JFace Dialog registers images via the JFaceRsources.initializeDefaultImages() call, which include a fallback path as well as an OSGi path:ĭeclareImage(bundle, Dialog.DLG_IMG_MESSAGE_ERROR, ICONS_PATH + "message_error.gif", Dialog.class, "images/message_error.gif") //$NON-NLS-1$ //$NON-NLS-2$ĭeclareImage(bundle, Dialog.DLG_IMG_MESSAGE_ERROR, ICONS_PATH + "message_error.png", Dialog.class, "images/message_error.png") //$NON-NLS-1$ //$NON-NLS-2$īetween Eclipse 4.3 and 4.4 the image changed from a. Images that could not be loaded are visible in the UI as small red squares.
0 Comments
Read More
Leave a Reply. |