Access to the image and other resource files in MIDlet

xiaoxiao2021-03-06  105

Through the test, you can use the directory in the MIDLET to be stored, and you can access it when you run. The program is now as follows

......

String [] imgpath = {"/srcs/byf_banshenyinliao.png","/srcs/fxh_byf_heying.png" ,????"/srcs/fxh_half_120.png""/srcs/fxh_jushou.png",/srcs / HEYING_FIVE.PNG "}

......

?? image image = null;

?? Try {??? image = image.createImage (imgpath [sel_num]); ?????????????????????????????????????????? Catch (eX) {??????????????????? EX.PrintStackTrace (); ???????????????}

?? Displayable nd = new BigPiccanvas (Image);

......

All pictures in this example are stored in the srcs directory, and the directory is packaged together when packaging Suilt. The generated jar runs under the simulator

转载请注明原文地址:https://www.9cbs.com/read-120393.html

New Post(0)