?? jfacemenutoolbarclass.java
字號:
/**@author WangJinTao,MengQingChang 2006
*/
package jfaceWindows;
import org.eclipse.jface.action.*;
import org.eclipse.jface.window.ApplicationWindow;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.*;
public class JFaceMenuToolBarClass extends ApplicationWindow {
private ExitActionClass exitAction;
public JFaceMenuToolBarClass() {
super(null);
// 將ApplicationWindow類實例作為參數傳過來
exitAction = new ExitActionClass(this);
this.addMenuBar();
this.addStatusLine();
this.addToolBar(SWT.FLAT | SWT.WRAP);
}
public void run() {
setBlockOnOpen(true);
open();
Display.getCurrent().dispose();
}
protected Control createContents(Composite parent) {
getShell().setText("JFace Menu and TooBar");
getShell().setSize(370, 250);
new Text(getShell(), SWT.BORDER);
setStatus("This is StatusLine");
return parent;
}
// 創建菜單
protected MenuManager createMenuManager() {
MenuManager menuBar = new MenuManager("");
MenuManager fileMenu = new MenuManager("文件(&F)");
MenuManager selectMenu = new MenuManager("選項");
menuBar.add(fileMenu);
fileMenu.add(selectMenu);
selectMenu.add(exitAction);
return menuBar;
}
// 創建工具欄
protected ToolBarManager createToolBarManager(int style) {
ToolBarManager toolBarManager = new ToolBarManager(style);
toolBarManager.add(exitAction);
return toolBarManager;
}
public static void main(String[] args) {
JFaceMenuToolBarClass menutoolbar = new JFaceMenuToolBarClass();
menutoolbar.run();
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -