本文整理汇总了Java中org.eclipse.ui.forms.widgets.FormText.setFont方法的典型用法代码示例。如果您正苦于以下问题:Java FormText.setFont方法的具体用法?Java FormText.setFont怎么用?Java FormText.setFont使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.ui.forms.widgets.FormText
的用法示例。
在下文中一共展示了FormText.setFont方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createFormText
import org.eclipse.ui.forms.widgets.FormText; //导入方法依赖的package包/类
/**
* Creates a form text.
*
* @param parent the parent to put the form text on
* @param text the form text to be displayed
* @return the created form text
*
* @see FormToolkit#createFormText(org.eclipse.swt.widgets.Composite, boolean)
*/
private FormText createFormText(Composite parent, String text) {
FormToolkit toolkit= new FormToolkit(getShell().getDisplay());
try {
FormText formText= toolkit.createFormText(parent, true);
formText.setFont(parent.getFont());
try {
formText.setText(text, true, false);
} catch (IllegalArgumentException e) {
formText.setText(e.getMessage(), false, false);
JavaPlugin.log(e);
}
formText.marginHeight= 2;
formText.marginWidth= 0;
formText.setBackground(null);
formText.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
return formText;
} finally {
toolkit.dispose();
}
}
示例2: AbstractEASyEditorPage
import org.eclipse.ui.forms.widgets.FormText; //导入方法依赖的package包/类
/**
* Sole constructor for this class.
* @param plp The {@link ProductLineProject} edited in this editor page.
* @param title The title for this editor page.
* @param parent The parent, holding this editor page.
*/
public AbstractEASyEditorPage(ProductLineProject plp, String title, Composite parent) {
super(parent, SWT.BORDER);
this.plp = plp;
setLayout(new FillLayout());
pageListeners = new ArrayList<IEASyPageListener>();
toolkit = new FormToolkit(getDisplay()); // display is assumed to be valid!
contentPane = toolkit.createScrolledForm(this);
GridLayout layout = new GridLayout();
contentPane.getBody().setLayout(layout);
//Set Title contentPane.setText(text) will cause that scrollbars won't work correctly.
FormText titleText = toolkit.createFormText(contentPane.getBody(), false);
String htmlTitle = "<form><p><span color=\"header\" font=\"header\">" + title + ": " + plp.getProjectName()
+ "</span></p></form>";
titleText.setWhitespaceNormalized(true);
titleText.setFont("header", JFaceResources.getHeaderFont());
titleText.setColor("header", toolkit.getColors().getColor(IFormColors.TITLE));
titleText.setText(htmlTitle, true, false);
}
示例3: initFormText
import org.eclipse.ui.forms.widgets.FormText; //导入方法依赖的package包/类
public static void initFormText(FormText formText) {
formText.setWhitespaceNormalized(false);
Font formTextFont = formText.getFont();
FontData formTextFontData = formTextFont.getFontData()[0];
FontData h1FontData = new FontData(formTextFontData.getName(), formTextFontData.getHeight() + 5, SWT.BOLD);
final Font h1Font = new Font(formTextFont.getDevice(), h1FontData);
formText.setFont(FONT_H1_KEY, h1Font);
FontData h3FontData = new FontData(formTextFontData.getName(), formTextFontData.getHeight() + 3, SWT.BOLD);
final Font h3Font = new Font(formTextFont.getDevice(), h3FontData);
formText.setFont(FONT_H3_KEY, h3Font);
Font codeFont = JFaceResources.getTextFont();
formText.setFont(FONT_CODE_KEY, codeFont);
formText.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
h1Font.dispose();
h3Font.dispose();
}
});
// Set fontKeySet = JFaceResources.getFontRegistry().getKeySet();
// if (fontKeySet != null) {
// for (Object fontKey : fontKeySet) {
// System.out.println(fontKey);
// }
// }
}
示例4: createConstraintText
import org.eclipse.ui.forms.widgets.FormText; //导入方法依赖的package包/类
/**
* Create an instance of form text prepared to display a plan element.
* @param toolkit
* @param parent
* @return the form text instance.
*/
public FormText createConstraintText(FormToolkit toolkit, Composite parent) {
final FormText text = createPlanText(toolkit, parent);
final FontData fontData = parent.getFont().getFontData()[0];
final Font font = new Font(null, fontData.getName(), fontData.getHeight(), SWT.ITALIC);
text.setFont("rationale", font);
return text;
}