JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Java ME、Google Android 平台與 JavaCard 討論區  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友    訂閱主題
reply to topicthreaded modego to previous topicgo to next topic
本主題所含的標籤
無標籤
作者 我照書抄的,為什麼還是不能Build??
ruin88kimo





發文: 9
積分: 0
於 2005-02-02 23:01 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class HelloMIDlet extends MIDlet{
  private Display display;
  public HelloMIDlet(){
    display=Display.getDisplay(this);
  }
  public void startApp(){
    TextBox t=new TextBox("Hello MIDP應用程式","Welcome to MIDP Programming",256,0);
    display.setCurrent(t);
  }
  public void pauseApp(){}
  public void destroyApp(boolean unconditional){}
}

-----------------------------------------

以上是程式碼

我照書抄的,但是為什麼build failed
我的sdk版本沒問題
j2me也重灌一次了

我還有個問題:我可以用javac HelloMIDlet.java編譯成功嗎
因為我試著去編譯過不了***

到底哪有問題

有人可以告訴我嗎


ruin88kimo edited on 2005-02-04 09:31
reply to postreply to post
作者 Re:我照書抄的,為什麼還是不能Build?? [Re:ruin88kimo]
fish1217

一步一腳印



發文: 696
積分: 6
於 2005-02-03 00:07 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
1) 請遵守版規(程式碼標記)
2) TextBox 不可以直接 display,
應該還要搭配form物件才對


reply to postreply to post
作者 Re:我照書抄的,為什麼還是不能Build?? [Re:fish1217]
atticcat

There is no cookie



發文: 702
積分: 4
於 2005-02-03 09:31 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
fish1217 wrote:
2) TextBox 不可以直接 display,
應該還要搭配form物件才對


TextBox跟Form同樣是Displayable..
他們是是可以被Diaplay給setCurrent的..TextField才需要搭配Form喲~~
不過..上二層樓那位新來的..還是記得要遵守版規呀~~~


atticcat edited on 2005-02-03 09:41
reply to postreply to post
作者 Re:我照書抄的,為什麼還是不能Build?? [Re:ruin88kimo]
atticcat

There is no cookie



發文: 702
積分: 4
於 2005-02-03 09:40 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
ruin88kimo wrote:
我照書抄的,但是為什麼build failed
我的sdk版本沒問題
j2me也重灌一次了

我還有個問題:我可以用javac HelloMIDlet.java編譯成功嗎
因為我試著去編譯過不了***

到底哪有問題

有人可以告訴我嗎

你這樣子問問題是沒有會看得懂的喲...
程式碼記得要標記一下..
and...
有錯誤..也要跟大家講錯誤訊息是啥...
不然要大家用猜猜看的方式來回答你嗎?~

自己用javac來編Midlet應該很麻煩吧...你得要include有WTK的library才行..
基本上,如果不用IDE ( ex , Eclipse,Jbuilder)
你應該也要用WTK提供的方式來編才對...至少書上應該會教這一套..
別忘了..編完還要verify才能拿來給模擬器跑...
(上面這些精華區應該都有講了吧,建議你書看仔細一點,再爬文一下.)


reply to postreply to post
作者 Re:我照書抄的,為什麼還是不能Build?? [Re:atticcat]
fish1217

一步一腳印



發文: 696
積分: 6
於 2005-02-03 13:11 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
atticcat wrote:
TextBox跟Form同樣是Displayable..
他們是是可以被Diaplay給setCurrent的..TextField才需要搭配Form喲~~
不過..上二層樓那位新來的..還是記得要遵守版規呀~~~

Sorry...與J2SE SWING 弄混且沒有測試之下就回文了
下次會更小心點
不過我試了一下一樓那一位仁兄的程式是可以跑的
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class TestMIDlet extends MIDlet{
private Display display;
public TestMIDlet()
{
 display=Display.getDisplay(this);
}
public void startApp()
{
       TextBoxt= new TextBox("Hello MIDP應用程式","Welcome to MIDP Programming",256,0);
     display.setCurrent(t);
}
public void pauseApp(){}
public void destroyApp(boolean unconditional){}
}

Tool
--
J2ME Wireless Toolkit 2.2

setting
---
API Selection
Target Platform:MIDP1.0

MIDlets
---
class:TestMIDlet


reply to postreply to post
作者 Re:我照書抄的,為什麼還是不能Build?? [Re:ruin88kimo]
ruin88kimo





發文: 9
積分: 0
於 2005-02-03 20:00 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
可是我的不行***
它出現了下面的訊息

''In order to compile you need to use the full J2SE SDK.
In order to use this feature please install J2SE
SDK 1.4 or later and reinstall J2ME Wireless Toolkit."

英文我看的懂
可是我再次安裝也有照著指出我的j2sdk目錄
為什麼還會這樣呢??


reply to postreply to post
作者 Re:我照書抄的,為什麼還是不能Build?? [Re:ruin88kimo]
ruin88kimo





發文: 9
積分: 0
於 2005-02-04 13:31 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我已經弄好了
我把目錄從 c:\program\java\j2sdk1.4.2_07
改成 c:\j2sdk1.4.2_07

謝謝各位


reply to postreply to post
» JWorld@TW »  Java ME、Google Android 平台與 JavaCard 討論區

reply to topicthreaded modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8