当前位置: 首页>>代码示例>>Java>>正文


Java StyledText.setFont方法代码示例

本文整理汇总了Java中org.eclipse.swt.custom.StyledText.setFont方法的典型用法代码示例。如果您正苦于以下问题:Java StyledText.setFont方法的具体用法?Java StyledText.setFont怎么用?Java StyledText.setFont使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.swt.custom.StyledText的用法示例。


在下文中一共展示了StyledText.setFont方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createTextWidget

import org.eclipse.swt.custom.StyledText; //导入方法依赖的package包/类
protected void createTextWidget(String textContents) {
	StyledText styledText = new StyledText(getComposite(), SWT.NONE);
	styledText.setText(textContents);
	styledText.setFont(getCourierFont());
	styledText.setEditable(false);
	//styledText.setWordWrap(true);		// seems to throw size out-of-whack
	Point size = styledText.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
	getComposite().setContent(styledText);
	getComposite().setExpandHorizontal(true);
	getComposite().setExpandVertical(true);
	getComposite().setMinWidth(size.x);
	getComposite().setMinHeight(size.y);
	getComposite().getContent().addListener(SWT.KeyUp, getToolbarCommandHandler());

	getToolItem().setSelection(true);		
	setContentTypeAdapter(new StyledTextAdapter(styledText, getFileEntry().getFilename()));
}
 
开发者ID:AppleCommander,项目名称:AppleCommander,代码行数:18,代码来源:TextFilterAdapter.java

示例2: createStyledText

import org.eclipse.swt.custom.StyledText; //导入方法依赖的package包/类
private StyledText createStyledText() {
	styledText = new StyledText(shell,
			SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL); // SWT.WRAP
	GridData gridData = new GridData();
	styledText.setFont(
			new Font(shell.getDisplay(), "Source Code Pro Light", 10, SWT.NORMAL));
	gridData.horizontalAlignment = GridData.FILL;
	gridData.grabExcessHorizontalSpace = true;
	gridData.verticalAlignment = GridData.FILL;
	gridData.grabExcessVerticalSpace = true;
	styledText.setLayoutData(gridData);
	styledText.addLineStyleListener(lineStyler);
	styledText.setEditable(false);
	styledText
			.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_GRAY));
	return styledText;
}
 
开发者ID:sergueik,项目名称:SWET,代码行数:18,代码来源:ScrolledTextEx.java

示例3: newTextArea

import org.eclipse.swt.custom.StyledText; //导入方法依赖的package包/类
public StyledText newTextArea(Composite composite, boolean editable, int sty) {
    int style = SWT.MULTI | SWT.V_SCROLL;
    if (!editable)
        style |= SWT.READ_ONLY;
    else
        style |= SWT.WRAP;

    StyledText d = new StyledText(composite, style);
    d.setText("To be entered\ntest\n\test\ntest");
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.heightHint = 80;
    gd.widthHint = 460;
    gd.verticalAlignment = GridData.VERTICAL_ALIGN_BEGINNING;
    d.setEditable(editable);
    d.setLayoutData(gd);
    d.setFont(FontShop.textFont());
    if (keyListener != null)
        d.addKeyListener(keyListener);
    d.setWordWrap(editable);
    WidgetShop.tweakTextWidget(d);
    return d;
}
 
开发者ID:openaudible,项目名称:openaudible,代码行数:23,代码来源:GridComposite.java

示例4: intializeEditor

import org.eclipse.swt.custom.StyledText; //导入方法依赖的package包/类
private void intializeEditor(StyledText expressionEditor, JavaLineStyler javaLineStyler,Composite toolBarComposite) {
	expressionEditor.setWordWrap(false);
	expressionEditor.addLineStyleListener(javaLineStyler);
	expressionEditor.setFont(new Font(null,"Arial", 10, SWT.NORMAL));
	expressionEditor.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 0, 0));
	expressionEditor.getSize();
	addDropSupport();
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:9,代码来源:ExpressionEditorComposite.java

示例5: createFormatedViewTabItem

import org.eclipse.swt.custom.StyledText; //导入方法依赖的package包/类
/**
 * 
 * Create formatted view tab in data viewer tab folder
 * 
 */
public void createFormatedViewTabItem() {
	if (isViewTabExist(Views.FORMATTED_VIEW_NAME)) {
		CTabItem item = getViewTabItem(Views.FORMATTED_VIEW_NAME);
		tabFolder.setSelection(item);
		dataViewLoader.reloadloadViews();
		return;
	}

	CTabItem tbtmFormattedView = new CTabItem(tabFolder, SWT.CLOSE);
	tbtmFormattedView.setData(Views.VIEW_NAME_KEY, Views.FORMATTED_VIEW_NAME);
	tbtmFormattedView.setText(Views.FORMATTED_VIEW_DISPLAYE_NAME);
	{
		Composite composite = new Composite(tabFolder, SWT.NONE);
		tbtmFormattedView.setControl(composite);
		composite.setLayout(new GridLayout(1, false));
		{
			formattedViewTextarea = new StyledText(composite, SWT.BORDER | SWT.READ_ONLY | SWT.H_SCROLL
					| SWT.V_SCROLL);
			formattedViewTextarea.setFont(SWTResourceManager.getFont("Courier New", 9, SWT.NORMAL));
			formattedViewTextarea.setEditable(false);
			formattedViewTextarea.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
		}
	}
	tabFolder.setSelection(tbtmFormattedView);
	dataViewLoader.setFormattedViewTextarea(formattedViewTextarea);
	dataViewLoader.reloadloadViews();
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:33,代码来源:DebugDataViewer.java

示例6: toStyledText

import org.eclipse.swt.custom.StyledText; //导入方法依赖的package包/类
/**
 * Creates and returns with a new {@link StyledText styled text} instance hooked up to the given parent composite.
 *
 * @param parent
 *            the parent of the styled text control.
 * @param style
 *            style bits for the new text control.
 * @return a new styled text control initialized from the descriptor.
 */
default StyledText toStyledText(final Composite parent, final int style) {

	final StyledText text = new StyledText(parent, READ_ONLY | style);
	text.setText(getText());
	text.setStyleRanges(getRanges());
	text.setFont(getFont());
	text.setEditable(false);
	text.setEnabled(false);

	final AtomicReference<Color> colorRef = new AtomicReference<>();
	final IPreferenceStore prefStore = EditorsUI.getPreferenceStore();
	if (null == prefStore
			|| prefStore.getBoolean(PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT)) {

		colorRef.set(getDefault().getSystemColor(COLOR_LIST_BACKGROUND));

	} else {

		RGB rgb = null;
		if (prefStore.contains(PREFERENCE_COLOR_BACKGROUND)) {
			if (prefStore.isDefault(PREFERENCE_COLOR_BACKGROUND)) {
				rgb = getDefaultColor(prefStore, PREFERENCE_COLOR_BACKGROUND);
			} else {
				rgb = getColor(prefStore, PREFERENCE_COLOR_BACKGROUND);
			}
			if (rgb != null) {
				colorRef.set(new Color(text.getDisplay(), rgb));
			}
		}

	}

	if (null != colorRef.get()) {
		text.setBackground(colorRef.get());
		text.addDisposeListener(e -> {
			if (!colorRef.get().isDisposed()) {
				colorRef.get().dispose();
			}
		});
	}

	text.pack();
	return text;
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:54,代码来源:StyledTextDescriptor.java


注:本文中的org.eclipse.swt.custom.StyledText.setFont方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。