📄 jfaceexample.java
字号:
/*
* @author 于宽 创建日期 2005-9-23
* email:yukuan_dljd@126.com
* TODO 要更改此生成的文件的模板,请转至
* 窗口 - 首选项 - Java - 代码样式 - 代码模板
*/
package org.eclipseguide.jface;
/**
* @author Administrator
*
* TODO 要更改此生成的类型注释的模板,请转至
* 窗口 - 首选项 - Java - 代码样式 - 代码模板
*/
import org.eclipse.jface.action.*;
import org.eclipse.jface.window.ApplicationWindow;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.*;
public class JFaceExample extends ApplicationWindow
{
private ExitAction exitAction;
public JFaceExample()
{ super(null);
exitAction = new ExitAction(this);
this.addMenuBar();
this.addStatusLine();
this.addToolBar(SWT.FLAT | SWT.WRAP);
}
protected Control createContents(Composite parent)
{
getShell().setText("JFace File Explorer");
setStatus("JFace Example v1.0");
return parent;
}
protected void initializeBounds()
{
getShell().setSize(300, 200);
}
protected MenuManager createMenuManager()
{
MenuManager menuBar = new MenuManager("");
MenuManager fileMenu = new MenuManager("&File");
menuBar.add(fileMenu);
fileMenu.add(exitAction);
return menuBar;
}
protected StatusLineManager createStatusLineManager()
{
StatusLineManager statusLineManager = new StatusLineManager();
statusLineManager.setMessage("Hello, world!");
return statusLineManager;
}
protected ToolBarManager createToolBarManager(int style)
{
ToolBarManager toolBarManager = new ToolBarManager(style);
toolBarManager.add(exitAction);
return toolBarManager;
}
public static void main(String[] args)
{
JFaceExample fe = new JFaceExample();
fe.setBlockOnOpen(true);
fe.open();
Display.getCurrent().dispose();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -