当前位置: 代码迷 >> J2ME >> lwuit 触屏虚拟键盘的实现及实现一个动态进度条,该如何解决
  详细解决方案

lwuit 触屏虚拟键盘的实现及实现一个动态进度条,该如何解决

热度:10009   发布时间:2013-02-25 21:34:17.0
lwuit 触屏虚拟键盘的实现及实现一个动态进度条
lwuit 做到现在已经实现了触屏,但没做出虚拟键盘,实现了进度条,但它不是动态的,动态在Form 上怎么实现呢?
各位大侠,求解。。。帮帮忙吧
这个解决方法怎么用啊?

解决方法: 
在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(); 
  } 


------解决方案--------------------------------------------------------
我的进度条(一行滚动文字)是放在dialog中的,虚拟键盘,lwuit现在的高版本中不是已经加入了虚拟键盘了吗?
------解决方案--------------------------------------------------------
lwuit的高版本是1.5还是1.4,1.4中为什么没有这个设置。