LWUIT
Light Weight User Interface Toolkit 的縮寫。由sun公司推出的開源輕量級UI工具包,可良好的運行在JavaSE及JavaME平台上。
主要的特性包括:類似Swing 的MVC架構,支持多種可視化組件,布局(Layouts),皮膚更換,字型,觸控螢幕,動畫效果,Rich控制項,3D集成, Painter,模式對畫框等。
其目的是為當前的Java MIDP和Swing的發展提供更好的新界面或在MIDP 2.0的手機上使用Java ME技術。
使用LWUIT的應用程式界面/**********************LWUIT版hello world *************/
import com.sun.lwuit.Display;
import com.sun.lwuit.Form;
import com.sun.lwuit.Label;
import com.sun.lwuit.layouts.BorderLayout;
import com.sun.lwuit.plaf.UIManager;
import com.sun.lwuit.util.Resources;
public class HelloMidlet extends javax.microedition.midlet.MIDlet {
public void startApp() {
//init the LWUIT Display
Display.init(this);
// Setting the application theme is discussed
// later in the theme chapter and the resources chapter
try {
Resources r = Resources.open("/myresources.res");
UIManager.getInstance().setThemeProps(r.getTheme(
r.getThemeResourceNames()[0])
);
} catch (java.io.IOException e) {
}
Form F = new Form();
f.setTitle("Hello World");
f.setLayout(new BorderLayout());
f.addComponent("Center", new Label("I am a Label"));
f.show();
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
}
/***** *******/
