关于j2me的显示图片问题 10
我用的是Eclipse+eclipseme+wtk环境,启动时没有创建独自的项目和放图片的位置,所以我的图片没法显示,小弟刚学不久,忘高手指教!!感激不尽~~import...
我用的是Eclipse+eclipseme+wtk环境,启动时没有创建独自的项目和放图片的位置,所以我的图片没法显示,小弟刚学不久,忘高手指教!!感激不尽~~
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class ChoiceGroupMIDlet extends MIDlet implements CommandListener {
private Display display;
private Form form;
private Image duke;
private Image[] imageArray;
private ChoiceGroup choice;
private Command exitCommand =new Command ("Exit",Command.EXIT,1);
public ChoiceGroupMIDlet(){
display=Display.getDisplay(this);
}
protected void destroyApp(boolean arg0) {
// TODO Auto-generated method stub
}
protected void pauseApp() {
// TODO Auto-generated method stub
}
protected void startApp() {
// TODO Auto-generated method stub
form=new Form("Hello");
try{
Image duke=Image.createImage("/ch5/ee.png");
imageArray=new Image[]{duke,duke,duke};
String[] stringArray={"Option A","Option B","Option C"};
choice =new ChoiceGroup("choice group",ChoiceGroup.MULTIPLE,stringArray,imageArray);
form.append(choice);
}catch(Exception fe){
}
form.addCommand(exitCommand);
form.setCommandListener(this);
display.setCurrent(form);
}
public void commandAction(Command c, Displayable s) {
// TODO Auto-generated method stub
if(c==exitCommand){
destroyApp(false);
notifyDestroyed();
}
}
}
你说的是eclipse下吗? 它下面根本没有rsc文件夹呀 展开
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class ChoiceGroupMIDlet extends MIDlet implements CommandListener {
private Display display;
private Form form;
private Image duke;
private Image[] imageArray;
private ChoiceGroup choice;
private Command exitCommand =new Command ("Exit",Command.EXIT,1);
public ChoiceGroupMIDlet(){
display=Display.getDisplay(this);
}
protected void destroyApp(boolean arg0) {
// TODO Auto-generated method stub
}
protected void pauseApp() {
// TODO Auto-generated method stub
}
protected void startApp() {
// TODO Auto-generated method stub
form=new Form("Hello");
try{
Image duke=Image.createImage("/ch5/ee.png");
imageArray=new Image[]{duke,duke,duke};
String[] stringArray={"Option A","Option B","Option C"};
choice =new ChoiceGroup("choice group",ChoiceGroup.MULTIPLE,stringArray,imageArray);
form.append(choice);
}catch(Exception fe){
}
form.addCommand(exitCommand);
form.setCommandListener(this);
display.setCurrent(form);
}
public void commandAction(Command c, Displayable s) {
// TODO Auto-generated method stub
if(c==exitCommand){
destroyApp(false);
notifyDestroyed();
}
}
}
你说的是eclipse下吗? 它下面根本没有rsc文件夹呀 展开
2个回答
展开全部
将图片放在res文件夹下的ch5文件夹中即可,文件名要是ee.png
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询