?? customdialogclass.java
字號:
/**
*@author: WangJinTao,MengQingChang2006
*/
package jfaceDialog;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.*;
import org.eclipse.swt.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
public class CustomDialogClass extends Dialog {
public CustomDialogClass(Shell parentShell) {
super(parentShell);
}
// 在對話框中添加組件
protected Control createDialogArea(Composite parent) {
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
composite.setLayout(new GridLayout(2, false));
final Label usernameLabel = new Label(composite, SWT.NONE);
usernameLabel.setText("用戶名:");
final Text usernameText = new Text(composite, SWT.BORDER);
GridData data = new GridData(GridData.FILL_HORIZONTAL);
usernameText.setLayoutData(data);
final Label passwordLabel = new Label(composite, SWT.NONE);
passwordLabel.setText("密 碼:");
final Text passwordText = new Text(composite, SWT.BORDER | SWT.PASSWORD);
data = new GridData(GridData.FILL_HORIZONTAL);
passwordText.setLayoutData(data);
return composite;
}
/**
* 定制窗體樣式 protected int getShellStyle() { return SWT.MIN; }
*/
// 添加按鈕
protected void createButtonsForButtonBar(Composite parent) {
createButton(parent, IDialogConstants.OK_ID, "確定", true);
createButton(parent, IDialogConstants.CANCEL_ID, "取消", true);
createButton(parent, IDialogConstants.NO_ID, "清除", true);
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -