How to add an icon in (implicit) list in J2me using Netbeans???
I am developing J2ME app using [B][U]NetBeans[/U][/B]; I am created one List of menu using 'List' control. In that list there is a one menu named as [B]Map[/B]. For this [B]Map[/B] menu, I want to add an icon. I tried to do this & code is -
[CODE]Image Mainlistmap;
try
{
Mainlistmap = Image.createImage("/src/map.png");
}
catch(Exception ex)
{
System.out.println(ex.getMessage());
} [/CODE]
I have stored my entire project in following ditectory- E:\MScIT Part 2\MobileLocationReminder
MobileLocationReminder folder is project folder contains all the stuffs of project such as src folder, dist folder, build folder, nbproject folder, build.xml file
I have stored icon in [B]src folder[/B] of & icon name is map.png and size is 30X33.
I want to display a map.png icon to Map menu in the list.... but after doing all these things it is not giving me a desired result.
Then Where do i store an image icon to access my project correctly & what path should be given to access an image in project????
Re: How to add an icon in (implicit) list in J2me using Netbeans???
You may want to look inside the resulting .jar file, if it contains map.png anywhere or not. (.jar files are actually using .zip format)
Re: How to add an icon in (implicit) list in J2me using Netbeans???
@ wizard_hu_ :
Yess it is present in .jar file. So now?? what should I do????
Re: How to add an icon in (implicit) list in J2me using Netbeans???
Are you getting Exception ??
if yes try - Mainlistmap = Image.createImage("/map.png");
Re: How to add an icon in (implicit) list in J2me using Netbeans???
@im2amit :- That means i have to keep an icon outside the src folder along with other folders..... right????? even i did it before many time...... But never mind..... if you are saying then I will do that again.....
Re: How to add an icon in (implicit) list in J2me using Netbeans???
@im2amit :- Nothing happened....... problem still persist.......
Re: How to add an icon in (implicit) list in J2me using Netbeans???
Do you get an exception after all? What does it say?
Re: How to add an icon in (implicit) list in J2me using Netbeans???
Are you getting file no found exception - if yes check - the filename its case sensitive and Mainlistmap = Image.createImage("/map.png"); keeping the map.png in scr folder only.
At time if you open and save the file back using Paint in windows system it might be named as Map.png or map.PNG.... it to be exact in your code as your file system i.e. inside the jar
Re: How to add an icon in (implicit) list in J2me using Netbeans???
[QUOTE=wizard_hu_;908348]Do you get an exception after all? What does it say?[/QUOTE]
Yes it is throwing an exception as [B]null[/B] which is printed on bottom side [U]output Window[/U] of Netbeans but it doesn't halt execution....
Re: How to add an icon in (implicit) list in J2me using Netbeans???
[QUOTE=im2amit;908381]Are you getting file no found exception - if yes check - the filename its case sensitive and Mainlistmap = Image.createImage("/map.png"); keeping the map.png in scr folder only.
At time if you open and save the file back using Paint in windows system it might be named as Map.png or map.PNG.... it to be exact in your code as your file system i.e. inside the jar[/QUOTE]
No I am not getting FileNotFoundException.... but I am getting [B]null[/B] value which is printed on bottom side [U]Output Window[/U] where program execution activity we can see.
Re: How to add an icon in (implicit) list in J2me using Netbeans???
@ im2amit :- Sir........ :) I did accordingly whatever you said in second and first suggestion. And problem is solved:D. Thanx a lot Amitabh Sir for your support and Golden value suggestions..... keep on supporting like that....... Take care....;)
Re: How to add an icon in (implicit) list in J2me using Netbeans???
@wizard_hu_ :- Sir...... my problem got solved...... Thanx to take interest in my problem and suggest me. Keep on supporting like that..... I need your suggestions...... Thank you sir......