Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why does "Form.append(ImageItem i) not work.

 
Xiaoxi Luo
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,everybody.
I am writting a program for palm. The "Form.append(ImageItem i)" does work only on WTK simulator but not on palm. Just "Form.append(Image i)" dose work on both. What is wrong?
Thanks in advance
 
Arijit Ghosh
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please post the code that you are using

Arijit
 
Xiaoxi Luo
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Arijit,
thank a lot for your help.

a fragment of the code:


public class AgentGui extends Form implements CommandListener{
private ServiceProvideAgent myAgent;
private Command closeCommand;
private Image source1;
private Image source2;
private Image source3;
private ImageItem item1;
private ImageItem item2;
private ImageItem item3;

public AgentGui(String title, ServiceProvideAgent agent) {
super(title);
myAgent=agent;
try{
StringItem si1=new StringItem("","\n");
si1.setPreferredSize(0,5);
StringItem si2=new StringItem("","\n");
si2.setPreferredSize(0,5);

source1 = Image.createImage("/ehealthlab_s.png");
ImageItem item1=new ImageItem("ehealthlab", source1, Item.LAYOUT_VCENTER, "ehealthlab");
item1.setLayout(Item.LAYOUT_NEWLINE_AFTER );
append(item1);
append(si1);

source2=Image.createImage("/akogrimo_s.png");
ImageItem item2=new ImageItem("akogrimo", source2, Item.LAYOUT_VCENTER, "akogrimo");
item2.setLayout(Item.LAYOUT_NEWLINE_AFTER );
append(item2);
append(si2);

source3=Image.createImage( "/sikosa_s.png");
ImageItem item3=new ImageItem("sikosa", source3, Item.LAYOUT_VCENTER, "sikosa");
item3.setLayout(Item.LAYOUT_NEWLINE_AFTER );
append(item3);

} catch (Exception e) {
e.printStackTrace();
}
closeCommand=new Command("Close", Command.BACK,1);
addCommand(closeCommand);
setCommandListener(this);
}
public void commandAction(Command c, Displayable dp) {

if (c==closeCommand){
GuiEvent ev=new GuiEvent((Object)this, myAgent.CLOSE_EVENT);
myAgent.postGuiEvent(ev);
}
}
...........
...........
}
 
William Frantz
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Xiaoxi Luo:
Hi,everybody.
I am writting a program for palm. The "Form.append(ImageItem i)" does work only on WTK simulator but not on palm. Just "Form.append(Image i)" dose work on both. What is wrong?
Thanks in advance


Welcome to the world of J2ME. Write once, debug everywhere.

The JVM on the Palm is broken. If it works on the simulator, then by rights it should work on every J2ME device. The reality just ain't so. I'm not kidding you when I say, you can't use about half of the more advanced features of MIDP if you truly want an application that will run on multiple platforms. Most devices have horribly broken JVMs.

Have you ever tried writing Cascading Style Sheets that follow the W3 standards? Almost everything you want to do is broken in one web browser or another. J2ME is much the same.

William Frantz
http://SprintDevelopers.com
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic