Re: [J2ME] Image.createImage(String name)的問題

看板java作者 (!H45)時間19年前 (2006/11/20 22:48), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/3 (看更多)
※ 引述《Nessie0924 (雷聲將季節切了開)》之銘言: : 不好意思,想請問一下,在J2ME中,我按照書上的範例輸入: : ....(前略;不過下面的部分是在一個extends Canvas的物件裡) : Image source; : Image copy; : // constructor; 名稱略過,下面是建構子內容; : try{ : source = Image.createImage("/picture_name.png"); : .... : } : ......(後略) : 在執行時會在標色那一行丟出IOException,我已經把圖片放在和.java同一個目 : 錄底下,仍無法正確執行,請問,這是什麼問題呢? : 圖片是書上的範例附的,應該是可以開啟才對;我用的模擬器是WTK 2.2版裡的 : DefaultColorPhone。 java.lang.Class.getResourceAsStream Before delegation, an absolute resource name is constructed from the given resource name using this algorithm: * If the name begins with a '/' ('\u002f'), then the absolute name of the resource is the portion of the name following the '/'. * Otherwise, the absolute name is of the following form: modified_package_name/name Where the modified_package_name is the package name of this object with '/' substituted for '.' ('\u002e'). 我想應該是圖片的位置不對吧 也許上面這段說明能幫上你的忙 Ref: J2ME lcdui API, J2SE API -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.115.205.85
文章代碼(AID): #15OS1CGN (java)
討論串 (同標題文章)
文章代碼(AID): #15OS1CGN (java)