my very first question:
I ' vebeentryingtofigurethisoutforacoupleofdays,butigottothepointilostmypatience。
thefollowingaresomecodeandmyprojectstructure。
question : howcanigetgetresources () toworkineclipseandafterbeingimportedtojar?
Thanks for the help。
公共枚举icons {
XXX (src/resoruces/icons/XYZ.png );
私有图像输入;
icons (字符串路径) {
try {
//willfailmiserablyineclipseandafterexportingtojar
icon=newimageicon(imageurl;
}catch(exceptione ) {
//workslikeacharineclipseandaftercreatingthejarfile
//withthefilesinthesamedirectory
icon=new image icon (路径;
}
}
ifthepngfileshavebeenpackagedintothejarinthesamelocationsastheyareintheoriginalsrcdirectorythen
XXX(resources/icons/XYZ.png );
Should产品the right result。