日韩欧美1区,亚洲丁香日韩,一区二区三区精品久久久http://www.aygfsteel.com/asdtiang/category/43554.html交流學習JAVA zh-cnThu, 14 Jan 2010 04:10:21 GMTThu, 14 Jan 2010 04:10:21 GMT60eclipse使用LWUIT時報錯java.lang.NoClassDefFoundError解決方法http://www.aygfsteel.com/asdtiang/articles/309219.htmlasdtiangasdtiangTue, 12 Jan 2010 10:57:00 GMThttp://www.aygfsteel.com/asdtiang/articles/309219.htmlhttp://www.aygfsteel.com/asdtiang/comments/309219.htmlhttp://www.aygfsteel.com/asdtiang/articles/309219.html#Feedback0http://www.aygfsteel.com/asdtiang/comments/commentRss/309219.htmlhttp://www.aygfsteel.com/asdtiang/services/trackbacks/309219.html

使用lwui遇到的一些常見問題:

模擬器一閃而過,出現classnotfound異常

一般可能是因為開發環境不兼容問題,建議采用Eclicpse 3.4、JDK1.6、插件EclicpseMe1.7.9、模擬器:WTK2.5.2相搭配。別一種可能是因為引入的lwuit沒有置頂的關系,只是按下圖操作配置一下就可以了。


如何裝控件居中,控件定位問題

控件只出現次數少的,可以按以下代碼實現定位

f = new Form("Form");

f.setLayout(new BoxLayout(BoxLayout.Y_AXIS));

bt_reset=new Button("重置");      

bt_reset.setPreferredW(50);

Container csubmission = new Container(new FlowLayout(Component.CENTER));

csubmission.addComponent(bt_reset);

f.addComponent(csubmission);

        f.show();

出現次數較多的話最好自己寫一個控件出來,不然會比較消耗資源。

文本域顯示文字不全,每一行最后幾個字看不到的問題

這個問題,只會在一部分機型是出現,像winmobile系統的手機一般沒有問題,但Symbian系列的上面會有文字顯示不全的問題。這個問題我采用了很我多種方法去解決,都不見成效,迫不得已查看源碼,結果真是因為那邊的問題,lwuit原本就沒有漢化,所以計算文字的長度時是把一個字當一個字母來計算的,英文字母的長度比中文的小,所以每一行里的文字字數按照它的計算會比現實多幾個。

解決方案:將源碼里面被用來計算文字長度的英文字母改成中文。

list過長,下面的項顯示不出來?

List顯示問題,程序寫出來發現在list過長時,不會滾動,下面的內容全部無法查看。經查看原demo發現需要設置form.setScrollable(false);因為當加進form里時,整個list被視為一個控件,而在默認情況下form.setScrollable(true),在這種情況下,界面內容過長時會自動滾動,但是它是靠移動焦點來滾動的。而整個list這種情況下只占一個焦點所以不能滾動。

解決方案:form.setScrollable(false);

轉載注明出處:j2me 交流群:65676039 ----逐夢



asdtiang 2010-01-12 18:57 發表評論
]]>
利用SMSLib通過COM來發短信(JAR包及配置) XMLhttp://www.aygfsteel.com/asdtiang/articles/309211.htmlasdtiangasdtiangTue, 12 Jan 2010 10:07:00 GMThttp://www.aygfsteel.com/asdtiang/articles/309211.htmlhttp://www.aygfsteel.com/asdtiang/comments/309211.htmlhttp://www.aygfsteel.com/asdtiang/articles/309211.html#Feedback0http://www.aygfsteel.com/asdtiang/comments/commentRss/309211.htmlhttp://www.aygfsteel.com/asdtiang/services/trackbacks/309211.html第一步:
The installation procedure for both the old Java Comm v2 and the new Java Comm v3 is identical.

Java Comm v2 is for Win32 systems and it is available on the Download page.

Java Comm v3 is for Linux systems and it is available for download directly from SUN downloads (registration is required)

To install it, unzip the downloaded archive file in a temporary place and do the following copies:

File comm.jar should go under JDKDIR/jre/lib/ext/
File javax.comm.properties should go under JDKDIR/jre/lib/
Library files (i.e. win32com.dll for Win32 or the .so Linux library files) should go under JDKDIR/jre/bin/
If you have a separate JRE directory, do the same copies for the JREDIR directory!

即comm.jar導入引用包中,javax.comm.properties拷貝到JDKDIR/jre/lib/下,win32com.dll拷貝到 JDKDIR/jre/bin/下



第二步:
把相應的包導入就可以了。

當時在做的時候,發現通過SMSLib發送程序還是比較麻煩的,他的日志采用的是slf4j,而slf4j是基于log4j的,這幾個不同的JAR包都是 在不同的地方下載的,在此所有的JAR整理出來,希望大家節約時間

JAR包下載地址http://www.ziddu.com/download/7798641/phonesendmessageJAR.rar.html


測試源碼:
package org.asdtiang.phone.sendMessage;

import org.smslib.IOutboundMessageNotification;
import org.smslib.Message.MessageEncodings;
import org.smslib.OutboundMessage;
import org.smslib.modem.SerialModemGateway;

public class Main {
private static org.smslib.Service srv = new org.smslib.Service();;

public static void creatService() {
SerialModemGateway gateway 
= new SerialModemGateway("SMS""COM3",
9600"LENOVO""6070");
gateway.setInbound(
true);
gateway.setOutbound(
true);
try {
srv.addGateway(gateway);
srv.startService();
System.out.println(
"Modem connected.");
sendSms(
"15100164985""測試用");
catch (Exception ex) {
ex.printStackTrace();
}
}

public static org.smslib.Service getService() {
if (srv == null) {
creatService();
}
return srv;
}

public static void disconnect() {
try {
// srv.disconnect();

System.out.println(
"Modem disconnected.");
catch (Exception ex) {
ex.printStackTrace();
}

}

public static void main(String args[]) {
creatService();
}

public static boolean sendSms(String mobile, String content) {
OutboundMessage msg 
= new OutboundMessage(mobile, content);
msg.setEncoding(MessageEncodings.ENCUCS2);
try {
srv.sendMessage(msg);
System.out.println(msg);
catch (Exception ex) {
// log.error(ex);
return false;
}
return true;
}

public void close() {
try {
srv.stopService();
catch (Exception ex) {
// log.error(ex);
}
}

public class OutboundNotification implements IOutboundMessageNotification {
public void process(String gatewayId, OutboundMessage msg) {
System.out.println(
"Outbound handler called from Gateway: "
+ gatewayId);
System.out.println(msg);
}
}
}



asdtiang 2010-01-12 18:07 發表評論
]]>
java利用SMSLib通過COM發送短信JAR包http://www.aygfsteel.com/asdtiang/articles/309209.htmlasdtiangasdtiangTue, 12 Jan 2010 10:05:00 GMThttp://www.aygfsteel.com/asdtiang/articles/309209.htmlhttp://www.aygfsteel.com/asdtiang/comments/309209.htmlhttp://www.aygfsteel.com/asdtiang/articles/309209.html#Feedback0http://www.aygfsteel.com/asdtiang/comments/commentRss/309209.htmlhttp://www.aygfsteel.com/asdtiang/services/trackbacks/309209.html The installation procedure for both the old Java Comm v2 and the new Java Comm v3 is identical.

Java Comm v2 is for Win32 systems and it is available on the Download page.

Java Comm v3 is for Linux systems and it is available for download directly from SUN downloads (registration is required)

To install it, unzip the downloaded archive file in a temporary place and do the following copies:

File comm.jar should go under JDKDIR/jre/lib/ext/
File javax.comm.properties should go under JDKDIR/jre/lib/
Library files (i.e. win32com.dll for Win32 or the .so Linux library files) should go under JDKDIR/jre/bin/
If you have a separate JRE directory, do the same copies for the JREDIR directory!

即comm.jar導入引用包中,javax.comm.properties拷貝到JDKDIR/jre/lib/下,win32com.dll拷貝到 JDKDIR/jre/bin/下



第二步:
把相應的包導入就可以了。

當時在做的時候,發現通過SMSLib發送程序還是比較麻煩的,他的日志采用的是slf4j,而slf4j是基于log4j的,這幾個不同的JAR包都是 在不同的地方下載的,在此所有的JAR整理出來,希望大家節約時間

包下載地址:http://download.csdn.net/source/1910091

asdtiang 2010-01-12 18:05 發表評論
]]>
主站蜘蛛池模板: 苍梧县| 连城县| 会昌县| 宜宾市| 衡阳市| 手游| 勃利县| 沙湾县| 平泉县| 达拉特旗| 彭泽县| 集安市| 章丘市| 枣强县| 同德县| 海南省| 蓬溪县| 宜黄县| 尼勒克县| 开江县| 永和县| 阿克陶县| 武城县| 惠安县| 吉木萨尔县| 克拉玛依市| 临邑县| 元谋县| 遵化市| 肥城市| 岑溪市| 桃园市| 黑山县| 临颍县| 咸丰县| 普定县| 萨嘎县| 凯里市| 柳州市| 钦州市| 隆安县|