當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。