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


Java FontDescriptor.createFont方法代码示例

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


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

示例1: convertFont

import org.eclipse.jface.resource.FontDescriptor; //导入方法依赖的package包/类
/**
 * Converts the font of the control by adding a single style bit, unless the font already have
 * that style.
 * <p>
 * If the font is converted, it will attach a {@link DisposeListener}
 * to the <code>control</code> to dispose the font when it's not needed anymore.
 * <p>
 * <em>If converting fonts is a frequent operation, this method will create
 * several {@link DisposeListener}s that can lead to high resource allocation</em>
 *
 * @param control whose font will be changed
 * @param style e.g. SWT.BOLD or SWT.ITALIC
 */
public static void convertFont(Control control, int style) {
  for (FontData fontData : control.getFont().getFontData()) {
    if (hasStyle(fontData, style)) {
      return;
    }
  }
  FontDescriptor fontDescriptor = FontDescriptor.createFrom(control.getFont()).setStyle(style);
  final Font newFont = fontDescriptor.createFont(control.getDisplay());
  control.setFont(newFont);
  control.addDisposeListener(new DisposeListener() {
    @Override
    public void widgetDisposed(DisposeEvent event) {
      newFont.dispose();
    }
  });
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:30,代码来源:FontUtil.java

示例2: getFont

import org.eclipse.jface.resource.FontDescriptor; //导入方法依赖的package包/类
@Override
public Font getFont(Object element) {
  if (element instanceof PaletteTreeNodeEditPart) {
    if (BOLD_FONT == null) {
      Widget widget = ((PaletteEntryEditPart) element).getWidget();
      if (widget instanceof TreeItem) {
        TreeItem treeItem = (TreeItem) widget;
        Font f = null;
        // there's something about the order of tree construction logic that causes treeitems to not be
        // fully ready yet here
        if (!treeItem.isDisposed()) {
          f = treeItem.getFont();
        } else {
          f = new Font(Display.getCurrent(), viewer.getPaletteViewerPreferences().getFontData());
        }
        FontDescriptor boldDescriptor = FontDescriptor.createFrom(f).setStyle(SWT.BOLD);
        BOLD_FONT = boldDescriptor.createFont(Display.getCurrent());
      }
    }
    return BOLD_FONT;
  }
  return null;
}
 
开发者ID:eclipse,项目名称:triquetrum,代码行数:24,代码来源:PaletteLabelProvider.java

示例3: constrainShellSize

import org.eclipse.jface.resource.FontDescriptor; //导入方法依赖的package包/类
@Override
protected void constrainShellSize() {
	super.constrainShellSize();
	if (Util.isCocoa()) {
		final Tree tree = getTreeViewer().getTree();
		final FontDescriptor treeFontDescriptor = FontDescriptor.createFrom(JFaceResources.getBannerFont()).setStyle(SWT.NORMAL);
		final Font treeFont = treeFontDescriptor.createFont(tree.getDisplay());
		updateTreeFont(treeFont);
		tree.addDisposeListener(new DisposeListener() {
			@Override
			public void widgetDisposed(DisposeEvent e) {
				treeFontDescriptor.destroyFont(treeFont);
			}
		});
	}
}
 
开发者ID:Albertus82,项目名称:JFaceUtils,代码行数:17,代码来源:EnhancedPreferenceDialog.java

示例4: getFont

import org.eclipse.jface.resource.FontDescriptor; //导入方法依赖的package包/类
@Override
public Font getFont(Object element){
	if (element instanceof Reminder) {
		Reminder reminder = (Reminder) element;
		if (boldFont == null) {
			Display disp = Display.getCurrent();
			Font defaultFont = cv.getViewerWidget().getControl().getFont();
			FontDescriptor boldDescriptor =
				FontDescriptor.createFrom(defaultFont).setStyle(SWT.BOLD);
			boldFont = boldDescriptor.createFont(disp);
		}
		Priority prio = reminder.getPriority();
		if (Priority.HIGH == prio) {
			return boldFont;
		}
	}
	return null;
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:19,代码来源:ReminderView.java

示例5: drawTextPart

import org.eclipse.jface.resource.FontDescriptor; //导入方法依赖的package包/类
private int drawTextPart(GC gc, int yStartPos, int xStartPos, TextPart text){
	Point textExtent = new Point(0, 0);
	if (text.getStyle() == TextPart.PartStyle.NORMAL) {
		textExtent = gc.stringExtent(text.getText());
		gc.drawText(text.getText(), xStartPos, yStartPos + spacing,
			SWT.DRAW_TRANSPARENT | SWT.DRAW_DELIMITER);
	} else if (text.getStyle() == TextPart.PartStyle.BOLD) {
		Font origFont = gc.getFont();
		FontDescriptor boldDescriptor =
			FontDescriptor.createFrom(gc.getFont()).setStyle(SWT.BOLD);
		Font boldFont = boldDescriptor.createFont(Display.getDefault());
		gc.setFont(boldFont);
		textExtent = gc.stringExtent(text.getText());
		gc.drawText(text.getText(), xStartPos, yStartPos + spacing,
			SWT.DRAW_TRANSPARENT | SWT.DRAW_DELIMITER);
		gc.setFont(origFont);
		boldFont.dispose();
	}
	return xStartPos + textExtent.x;
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:21,代码来源:NatTableCustomCellPainter.java

示例6: VaccinationCompositePaintListener

import org.eclipse.jface.resource.FontDescriptor; //导入方法依赖的package包/类
public VaccinationCompositePaintListener(){
	Display disp = Display.getCurrent();
	defaultFont = UiDesk.getFont(Preferences.USR_DEFAULTFONT);
	FontDescriptor boldDescriptor = FontDescriptor.createFrom(defaultFont).setStyle(SWT.BOLD);
	boldFont = boldDescriptor.createFont(disp);
	headerFont = new Font(disp, "Helvetica", 16, SWT.BOLD);
	
	distanceBetweenDiseases = (int) (distanceBetweenDiseases * getScaleFactor());
	
	fontHeightDefaultFont =
		(int) ((defaultFont.getFontData()[0].getHeight() + 5) * getScaleFactor());
	fontHeightBoldFont = (int) ((boldFont.getFontData()[0].getHeight() + 5) * getScaleFactor());
	
	entryHeight = (int) ((fontHeightBoldFont + 4) * getScaleFactor());
	defaultEntryHeight = entryHeight;
	
	naviVacMap = new TreeMap<Integer, Vaccination>();
	selectedVacc = null;
	showSide = CoreHub.userCfg.get(PreferencePage.VAC_SHOW_SIDE, false);
}
 
开发者ID:elexis,项目名称:elexis-3-base,代码行数:21,代码来源:VaccinationCompositePaintListener.java

示例7: createColumnFont

import org.eclipse.jface.resource.FontDescriptor; //导入方法依赖的package包/类
private Font createColumnFont(final ColumnOptions<T> options, ViewerCell cell) {
	Font font = options.getFont();
	if (font == null) {
		FontDescriptor fontDescriptor = FontDescriptor.createFrom(cell.getFont()).setStyle(options.getFontStyle());
		font = fontDescriptor.createFont(cell.getControl().getDisplay());
		options.setFont(font);
	}
	return font;
}
 
开发者ID:dakaraphi,项目名称:eclipse-plugin-commander,代码行数:10,代码来源:KaviListColumns.java

示例8: changeFont

import org.eclipse.jface.resource.FontDescriptor; //导入方法依赖的package包/类
/**
 * Changes a control's font
 * @param control
 * @param style
 * @throws DeviceResourceException 
 */
public static void changeFont(Control control, int style) throws DeviceResourceException {
    FontDescriptor boldDescriptor = FontDescriptor.createFrom(control.getFont());
    final Font boldFont = boldDescriptor.createFont(control.getDisplay());
    control.setFont(boldFont);
    control.addDisposeListener(new DisposeListener() {
  
        public void widgetDisposed(DisposeEvent arg0) {
            if (boldFont != null && !boldFont.isDisposed()) {
                boldFont.dispose();
            }
        }
        
    });
}
 
开发者ID:WiednerF,项目名称:ARXPlugin,代码行数:21,代码来源:SWTUtil.java

示例9: createPageLabel

import org.eclipse.jface.resource.FontDescriptor; //导入方法依赖的package包/类
private void createPageLabel(Composite composite, GridData gridData) {
	Label label = new Label(composite, SWT.LEFT);
	label.setText(document.getTitle());
	FontDescriptor boldDescriptor = FontDescriptor.createFrom(label.getFont()).setStyle(SWT.BOLD);
	Font boldFont = boldDescriptor.createFont(label.getDisplay());
	label.setFont(boldFont);
	label.setLayoutData(gridData);
}
 
开发者ID:sebastiangoetz,项目名称:slr-toolkit,代码行数:9,代码来源:BibtexEditor.java

示例10: getFontData

import org.eclipse.jface.resource.FontDescriptor; //导入方法依赖的package包/类
public Font getFontData() {
   	FontData fontData = Display.getCurrent().getSystemFont().getFontData()[0];
   	// new FontData()
       //FontDescriptor boldDescriptor = FontDescriptor.createFrom(fontData).setStyle(SWT.BOLD);
   	FontDescriptor boldDescriptor = FontDescriptor.createFrom(fontData).setHeight(fontData.getHeight() + 2);
       Font boldFont = boldDescriptor.createFont(Display.getCurrent());
       return boldFont;		
}
 
开发者ID:anatlyzer,项目名称:anatlyzer,代码行数:9,代码来源:ExplanationComposite.java

示例11: applyStyles

import org.eclipse.jface.resource.FontDescriptor; //导入方法依赖的package包/类
@Override
public void applyStyles(final TextStyle textStyle)
{
	FontData fontData = Display.getCurrent().getSystemFont().getFontData()[0];
	// new FontData()
    FontDescriptor boldDescriptor = FontDescriptor.createFrom(fontData).setStyle(SWT.BOLD);
    Font boldFont = boldDescriptor.createFont(Display.getCurrent());
    textStyle.font = boldFont;
}
 
开发者ID:anatlyzer,项目名称:anatlyzer,代码行数:10,代码来源:ProposalCategory.java

示例12: getFont

import org.eclipse.jface.resource.FontDescriptor; //导入方法依赖的package包/类
@Override
public Font getFont(Object element) {
	if (!engineList.getChecked(element))
		return null;
	if (boldFont == null) {
		FontDescriptor fontDescriptor = JFaceResources.getDialogFontDescriptor();
		fontDescriptor = fontDescriptor.setStyle(SWT.BOLD);
		boldFont = fontDescriptor.createFont(Display.getCurrent());
	}
	return boldFont;
}
 
开发者ID:eclipse,项目名称:thym,代码行数:12,代码来源:AvailableCordovaEnginesSection.java

示例13: applyStyles

import org.eclipse.jface.resource.FontDescriptor; //导入方法依赖的package包/类
@Override
public void applyStyles(TextStyle textStyle) {
	if(parentStyler != null) {
		parentStyler.applyStyles(textStyle);
	}
	
	Font font = textStyle.font;
	if(font == null) {
		font = JFaceResources.getDefaultFont(); 
	}
	FontDescriptor fontDescriptor = FontDescriptor.createFrom(font);
	fontDescriptor = getModifiedFontDescriptor(fontDescriptor);
	textStyle.font = fontDescriptor.createFont(Display.getCurrent());
}
 
开发者ID:GoClipse,项目名称:goclipse,代码行数:15,代码来源:StylerHelpers.java

示例14: changeFont

import org.eclipse.jface.resource.FontDescriptor; //导入方法依赖的package包/类
/**
 * Changes a control's font
 * @param control
 * @param style
 */
public static void changeFont(Control control, int style) {
    FontDescriptor boldDescriptor = FontDescriptor.createFrom(control.getFont()).setStyle(style);
    final Font boldFont = boldDescriptor.createFont(control.getDisplay());
    control.setFont(boldFont);
    control.addDisposeListener(new DisposeListener() {
        @Override
        public void widgetDisposed(DisposeEvent arg0) {
            if (boldFont != null && !boldFont.isDisposed()) {
                boldFont.dispose();
            }
        }
        
    });
}
 
开发者ID:arx-deidentifier,项目名称:arx,代码行数:20,代码来源:SWTUtil.java

示例15: getFont

import org.eclipse.jface.resource.FontDescriptor; //导入方法依赖的package包/类
private Font getFont() {
	if (font != null)
		return font;
	FontDescriptor desc = FontDescriptor.createFrom(
			Display.getCurrent().getSystemFont()).setStyle(SWT.ITALIC);
	font = desc.createFont(Display.getCurrent());
	return font;
}
 
开发者ID:GreenDelta,项目名称:olca-app,代码行数:9,代码来源:ColorStyler.java


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