一
Java語言的聲望和它在桌面應用程序(GUI程序)所取得的成就顯然極不相符
SWT本身僅僅是Eclipse組織為了開發Eclipse IDE環境所編寫的一組底層圖形界面 API
一是指性能上的穩定
另一個穩定是指SWT API包中的類
二
windows系統+eclipse
(
+swt
+bin(編譯輸出)
+src(原文件)
+AddressBookUI
+swt
+swt
+javaw
(
(
import org
import org
import org
import org
import org
import org
import org
import org
import org
import org
public class AddressBookUI {
private Shell shell;
private Text miscText;
private Text addrText;
private Text emailText;
private Text phoneText;
private Text lnameText;
private Text fnameText;
private Button cancelButton;
private Button saveButton;
private Button nextButton;
private Button prevButton;
private Button editButton;
private Button deleteButton;
private Button newButton;
public static void main(String[] args) {
AddressBookUI window = new AddressBookUI();
window
}
public void open() {
final Display display = new Display();
shell = new Shell();
shell
shell
{
newButton = new Button(shell
newButton
public void widgetSelected(SelectionEvent e) {
clearText();
setTextEditable(true);
enableEditButtons(false);
enableSaveButtons(true);
System
}
});
newButton
newButton
}
{
deleteButton = new Button(shell
deleteButton
public void widgetSelected(SelectionEvent e) {
clearText();
System
}
});
deleteButton
deleteButton
}
{
editButton = new Button(shell
editButton
public void widgetSelected(SelectionEvent e) {
setTextEditable(true);
enableEditButtons(false);
enableSaveButtons(true);
System
}
});
editButton
editButton
}
{
prevButton = new Button(shell
prevButton
public void widgetSelected(SelectionEvent e) {
System
}
});
prevButton
prevButton
}
{
nextButton = new Button(shell
nextButton
public void widgetSelected(SelectionEvent e) {
System
}
});
nextButton
nextButton
}
{
saveButton = new Button(shell
saveButton
public void widgetSelected(SelectionEvent e) {
setTextEditable(false);
enableEditButtons(true);
enableSaveButtons(false);
System
}
});
saveButton
saveButton
saveButton
}
{
cancelButton = new Button(shell
cancelButton
public void widgetSelected(SelectionEvent e) {
setTextEditable(false);
enableEditButtons(true);
enableSaveButtons(false);
System
}
});
cancelButton
cancelButton
cancelButton
}
{
final Group group = new Group(shell
group
group
{
final Label label = new Label(group
label
label
}
{
final Label label = new Label(group
label
label
}
{
final Label label = new Label
From:http://tw.wingwit.com/Article/program/Java/ky/201311/28751.html