📄 textfactory.java
字号:
package ExampleViewer.common;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
import ExampleViewer.form.FieldMode;
public class TextFactory {
/**
* @param parent
* @param mode
* @param layoutData
*/
static public Text create(Composite parent, int style, Object layoutData,int mode) {
if (mode == FieldMode.Read) {
style = SWT.V_SCROLL | SWT.WRAP | SWT.READ_ONLY;
} else if (mode == FieldMode.Edit) {
style = SWT.BORDER | SWT.V_SCROLL | SWT.WRAP;
} else if (mode == FieldMode.Preview) {
style = SWT.V_SCROLL | SWT.WRAP | SWT.READ_ONLY;
}
Text text = new Text(parent, style);
if (mode == FieldMode.Read || mode == FieldMode.Preview)
text.setBackground(parent.getBackground());
if (layoutData != null) text.setLayoutData(layoutData);
return text;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -