惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
Darknet – Hacking Tools, Hacker News & Cyber Security
V
Vulnerabilities – Threatpost
Cloudbric
Cloudbric
G
GRAHAM CLULEY
S
Securelist
Schneier on Security
Schneier on Security
Help Net Security
Help Net Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Project Zero
Project Zero
Spread Privacy
Spread Privacy
P
Privacy International News Feed
C
Cyber Attacks, Cyber Crime and Cyber Security
Cisco Talos Blog
Cisco Talos Blog
T
Tailwind CSS Blog
博客园_首页
有赞技术团队
有赞技术团队
Simon Willison's Weblog
Simon Willison's Weblog
Stack Overflow Blog
Stack Overflow Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Latest news
Latest news
T
Tor Project blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Attack and Defense Labs
Attack and Defense Labs
www.infosecurity-magazine.com
www.infosecurity-magazine.com
O
OpenAI News
J
Java Code Geeks
T
Tenable Blog
K
Kaspersky official blog
AWS News Blog
AWS News Blog
S
Security @ Cisco Blogs
The GitHub Blog
The GitHub Blog
T
Threatpost
月光博客
月光博客
H
Heimdal Security Blog
Security Latest
Security Latest
The Hacker News
The Hacker News
Y
Y Combinator Blog
A
Arctic Wolf
Apple Machine Learning Research
Apple Machine Learning Research
C
Cisco Blogs
美团技术团队
Microsoft Security Blog
Microsoft Security Blog
Hugging Face - Blog
Hugging Face - Blog
T
The Blog of Author Tim Ferriss
C
CERT Recently Published Vulnerability Notes
D
Docker
Google Online Security Blog
Google Online Security Blog
D
DataBreaches.Net
V
Visual Studio Blog
H
Help Net Security

博客园 - tatung zhang

全屏显示问题 sun发布lwuit1.4 深入理解 LWUIT 框架的 MVC lwuit控件关系模式图,Padding和Margin关系图 eclipse rcp 获取工程项目路径 eclipse content assist 代码提示功能失效解决办法 LWUIT 1.3 发布了 Eclipse RCP中添加第三方jar包的办法 lwuit---调整滚动条灵敏度值 lwuit---更改字体大小 j2me获取手机IMEI保证软件信息安全解决方案 show一下最新项目的界面图 谈谈移动开发 lwuit-list 困扰我的列颜色改变 lwuit-tab与list配合使用 lwuit-List控件使用 lwuit控件布局定位 VS2005创建智能设备项目失败 wince嵌入式应用程序开发环境搭建
lwuit ---一些细节疑难杂症整理笔记
tatung zhang · 2009-07-22 · via 博客园 - tatung zhang

1、textArea 显示文本内容,在部分手机上无法显示全部内容,每一行的最后几个字被挡住
琢磨了很久终于找了出来,解决方案如下:
  TextArea txtContent = new TextArea(strContent, 12, 24);
  //添加这一句即可
  txtContent.setWidestChar('一');
2、若要对文本框中的内容设置补丁:
txtContent.getStyle().setPadding(Component.RIGHT, 10);
内容往右10像素。
3、如果list上不想要显示文字多余时的省略号
name.setEndsWith3Points(false);
4、重写Dialog要让标题与Form的样式一致

dialog.show(100, 100,100,100, true);
5、声音播放
try {
     InputStream is = getClass().getResourceAsStream(
       "/res/NewMailSound.wav");
     Player player = Manager.createPlayer(is, "audio/x-wav");
     player.start();
    } catch (Exception e) {
     e.printStackTrace();
    }
6、使得TextField也能够在触屏手机上点击时出现输入编辑
解决方法:
在TextField源码上 加上editString();函数:
public void pointerReleased(int x, int y) {
        // unlike text area the text field supports shifting the cursor with the touch screen
     editString();
        String text = getText();
        int textLength = text.length();
        int position = 0;
        Font f = getStyle().getFont();
        x -= getAbsoluteX();
        for(int iter = 0 ; iter < textLength ; iter++) {
            int width = f.substringWidth(text, 0, iter);
            if(x > width) {
                position = iter;
            } else {
                break;
            }
        }
        if(position == textLength - 1) {
            if(f.stringWidth(text) < x) {
                position = textLength;
            }
        }
        setCursorPosition(position);
        repaint();
    }
或者官方的解决方法:http://forums.java.net/jive/thread.jspa?threadID=52716
7、震动
 public void MakeVibrate() {
  new Thread() {
   public void run() {
    try {
     Display.getInstance().vibrate(2000);
    } catch (Exception e) {
     e.printStackTrace();
    }
   }
  }.start();
 }
8、导致内存激增的原因(可以用自动模拟器的内存检测器进行监测C:\WTK2.5.2\bin\prefs.exe将你要的设置勾选)
而lwuit里面的源码有两句是会导致内存一直占用,一个是TextField中的这段代码

Code

一个是Display
lwuitGraphics.setGraphics(impl.getNativeGraphics());
这两个暂时还没有仔细去研究,但是确实吃内存的所在。
还有就是要巧用System.gc();进行内存回收,这样就会尽量的减少内存溢出的情况。
9、滚动条拖拽方向与内容显示相反,component中的代码修改如下

Code

10、开启wtk模拟器的触摸屏功能
打开\wtklib\devices\DefaultColorPhone目录下的DefaultColorPhone.properties文件(最好先安装一个UltraEdit之类的文本编辑器)。
然后找到touch_screen选项,修改为touch_screen=true

11、设置模拟器权限,以免开发过程中弹出烦人的提示
打开wtk模拟器。
选择Edit->Preferences->Security
然后将Security domain的选项设置为maximum。

12、内存和性能监视器
Edit->Preferences->Memory Monitor
Edit->Preferences->Profiler

13、出现安装后无法打开问题
有些Nokia手机会出现安装后无法打开,原因是安装包名称包含中文导致。

14、想要保存Sun Java (TM) Wireless Toolkit 2.5.2 for CLDC模拟器的RMS值,可以通过Preference - 存储(s)存储根目录  :(例:/disk)  来设置.

(选择你想要用的模拟器)然后到C:\Documents and Settings\Administrator\j2mewtk\2.5.2\appdb\DefaultColorPhone\filesystem\root1 建disk文件夹。
若出现了已经设置好后,仍然不能起到保存作用,到C:\Documents and Settings\Administrator\j2mewtk\2.5.2\appdb\disk 中将相应的RMS文件删除即可。

15、在S60 3th FP2版本上会出现String Index Out of Bounds Exception;原因DefaultLookAndFeel.java,在计算字符超过屏幕时出现异常。int widest = f.charWidth('W');必须改成int widest = f.charWidth('一');

16、如果客户端创建出现cvs [server aborted]: "add" requires write access to the repository,将服务器端的CVSNT Advanced的All user are read即可.

17、NokiaS60手机出现string index异常的原因。

com.sun.lwuit.Font.charWidth(char)

1、TextArea  line:186

   private static char widestChar = '国';

2、HTMLTextArea  line:33

   private static char widestChar = '一';

3、DefaultLookAndFeel  line:1124

   int widest = f.charWidth('国');