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


Java Font类代码示例

本文整理汇总了Java中org.eclipse.swt.graphics.Font的典型用法代码示例。如果您正苦于以下问题:Java Font类的具体用法?Java Font怎么用?Java Font使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: TableFigure

import org.eclipse.swt.graphics.Font; //导入依赖的package包/类
public TableFigure() {
	ToolbarLayout layout = new ToolbarLayout();
	setLayoutManager(layout);
	LineBorder lineBorder = new LineBorder(ColorConstants.lightGray, 2);
	setBorder(lineBorder);
	setOpaque(true);
	setBackgroundColor(ColorConstants.white);

	Font font = new Font(null, "宋体", 11, SWT.NORMAL);
	label.setFont(font);
	label.setBorder(new LineBorder(ColorConstants.lightGray));
	label.setIcon(Activator.getImage(Activator.IMAGE_TABLE_16));
	label.setOpaque(true);
	label.setBackgroundColor(ColorConstants.lightBlue);
	label.setForegroundColor(ColorConstants.black);
	add(label);
	add(columnFigure);
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:19,代码来源:TableFigure.java

示例2: PluginsSWT

import org.eclipse.swt.graphics.Font; //导入依赖的package包/类
public PluginsSWT(Shell shell, List<String> lines) {
    super(shell);
    this.pluginsBean = new PluginsBean(lines);
    
    target = pluginsBean.getPlugins();
    source = Stream.of(Plugin.values())
            .filter(p -> ! target.contains(p))
            .collect(Collectors.toList());
    targetOriginal = target.stream().collect(Collectors.toList());
    
    rowColorTitle = new Color(display, 70, 130, 180);
    int color = myOS == OS.Mac ? 249 : 239;
    rowColorBack = new Color(display, color, color, color);
    rowColorSelection = display.getSystemColor(SWT.COLOR_WHITE);
  
    fontAwesome = loadCustomFont(getFontAwesomeSize());
    fontGap = new Font(display, fontName, 4, SWT.NORMAL);
    rowTitleFont = new Font(display, fontName, getTopFontSize(), SWT.BOLD);
    rowTextFont = new Font(display, fontName, getTopFontSize() - 2, SWT.NORMAL);
    styleTitle = new TextStyle(rowTitleFont, rowColorTitle, null);
    styleGap = new TextStyle(fontGap, display.getSystemColor(SWT.COLOR_BLACK), null);
    styleRow = new TextStyle(rowTextFont, display.getSystemColor(SWT.COLOR_BLACK), null);
    styleTitleSelected = new TextStyle(rowTitleFont, rowColorSelection, null);
    styleRowSelected = new TextStyle(rowTextFont, rowColorSelection, null);
}
 
开发者ID:gluonhq,项目名称:ide-plugins,代码行数:26,代码来源:PluginsSWT.java

示例3: createTopContent

import org.eclipse.swt.graphics.Font; //导入依赖的package包/类
protected void createTopContent(String title, InputStream imageName) {
    Composite top = new Composite(composite, SWT.NONE);

    top.setLayout(new GridLayout(2, false));
    top.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    top.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
    
    final Image image = new Image(top.getDisplay(), imageName);
    Image resized = resizeImage(image, 48, 48);
    Label labelImage = new Label(top, SWT.CENTER);
    labelImage.setImage(resized);
    
    Label label = new Label(top, SWT.NONE);
    label.setText(title);
    final Font newFont = new Font(display, fontName, getTitleFontSize(), SWT.NORMAL);
    label.setFont(newFont);
    label.setBackground(rowColorSelection);
    
    createLineContent();
    
    top.addDisposeListener(e -> {
        newFont.dispose();
        resized.dispose();
    });
}
 
开发者ID:gluonhq,项目名称:ide-plugins,代码行数:26,代码来源:PluginDialog.java

示例4: createFont

import org.eclipse.swt.graphics.Font; //导入依赖的package包/类
private Font createFont ( final ResourceManager resourceManager )
{
    final Font defaultFont = resourceManager.getDevice ().getSystemFont ();

    if ( defaultFont == null )
    {
        return null;
    }

    final FontData fd[] = FontDescriptor.copy ( defaultFont.getFontData () );
    if ( fd == null )
    {
        return null;
    }

    for ( final FontData f : fd )
    {
        if ( this.fontSize > 0 )
        {
            f.setHeight ( this.fontSize );
        }
    }
    return resourceManager.createFont ( FontDescriptor.createFrom ( fd ) );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:25,代码来源:TitleRenderer.java

示例5: initialize

import org.eclipse.swt.graphics.Font; //导入依赖的package包/类
private void initialize() {
	GridLayout gridLayout = new GridLayout();
	gridLayout.numColumns = 1;
	GridData gridData = new org.eclipse.swt.layout.GridData();
	gridData.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
	gridData.grabExcessVerticalSpace = true;
	gridData.grabExcessHorizontalSpace = true;
	gridData.verticalAlignment = org.eclipse.swt.layout.GridData.FILL;
	
	//minimum size (when dialog open)
	gridData.minimumHeight = 200;
	gridData.minimumWidth = 300;
	
	this.setLayout(gridLayout);
	textArea = new Text(this, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
	textArea.setFont(new Font(null,"Tahoma",10,0));
	textArea.setLayoutData(gridData);
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:19,代码来源:TextEditorComposite.java

示例6: initialize

import org.eclipse.swt.graphics.Font; //导入依赖的package包/类
private void initialize() {
	labelSyntaxe = new Label(this, SWT.NONE);
	
	labelSyntaxe.setText("SQL query syntax examples :\n");
	labelSyntaxe.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,true,false));
	labelSQLQuery = new Label(this, SWT.NONE);
	labelSQLQuery.setFont(new Font(null,"Tahoma",8,1));
	labelSQLQuery.setText("SELECT * FROM EMPLOYEES WHERE (NAME='{parameter_name}')\n"
							+ "{? = CALL STORED_FUNCTION({parameter_name})}\n"
							+ "{CALL STORED_PROCEDURE({parameter_name})}\n\n");
	labelSQLQuery.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,true,false));
	textAreaSQLQuery = new Text(this, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
	textAreaSQLQuery.setFont(new Font(null,"Tahoma",10,0));
	textAreaSQLQuery.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
	GridLayout gridLayout = new GridLayout();
	this.setLayout(gridLayout);
	setSize(new org.eclipse.swt.graphics.Point(402,289));
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:19,代码来源:SqlQueryEditorComposite.java

示例7: ViewLabelProvider

import org.eclipse.swt.graphics.Font; //导入依赖的package包/类
public ViewLabelProvider() {
	Device device = Display.getCurrent();

	fontSystem = device.getSystemFont();

	FontData fontData = fontSystem.getFontData()[0];
	
	fontDetectedDatabaseObject = new Font(device, fontData);
	
	FontData fontDataModified = fontSystem.getFontData()[0];
	fontDataModified.setStyle(SWT.BOLD);
	fontModifiedDatabaseObject = new Font(device, fontDataModified);

	colorUnloadedProject = new Color(device, 12, 116, 176);
	colorDisabledDatabaseObject = new Color(device, 255, 0, 0);
	colorInheritedDatabaseObject = new Color(device, 150, 150, 150);
	colorUnreachableDatabaseObject = new Color(device, 255, 140, 0);
	colorDetectedDatabaseObject = new Color(device, 192, 219, 207);
}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:20,代码来源:ViewLabelProvider.java

示例8: addStats

import org.eclipse.swt.graphics.Font; //导入依赖的package包/类
private void addStats() {

		for (String key : statsProject.keySet()) {
			if (key != project.getName()) {
				CLabel title = new CLabel(descriptifRight, SWT.BOLD);
				title.setText(key);
				title.setImage(new Image(display, getClass()
						.getResourceAsStream(
								"images/stats_"
										+ key.replaceAll(" ", "_")
												.toLowerCase() + "_16x16.png")));
				title.setBackground(new Color(display, 255, 255, 255));
				title.setMargins(10, 10, 0, 0);

				FontData[] fd = title.getFont().getFontData();
				fd[0].setStyle(SWT.BOLD);
				title.setFont(new Font(title.getFont().getDevice(), fd));

				CLabel subText = new CLabel(descriptifRight, SWT.NONE);
				subText.setText(statsProject.get(key)
						.replaceAll("<br/>", "\r\n").replaceAll("&nbsp;", " "));
				subText.setBackground(new Color(display, 255, 255, 255));
				subText.setMargins(30, 0, 0, 0);
			}
		}
	}
 
开发者ID:convertigo,项目名称:convertigo-eclipse,代码行数:27,代码来源:StatisticsDialog.java

示例9: paintElement

import org.eclipse.swt.graphics.Font; //导入依赖的package包/类
@Override
void paintElement(PaintEvent e) {
	GC g = e.gc;
	g.setBackground(this.getBackground());
	int width  = this.getBounds().width;
	int height = this.getBounds().height;
	
	// clear entire canvas where button will be painted
	g.fillRectangle(0, 0, width, height);
	
	// draw text
	g.setForeground(this.meColorForeground);
	FontData fd = new FontData();
	fd.setHeight(8);
	if(textIsBold){
		fd.setStyle(SWT.BOLD);
	}else{
		fd.setStyle(SWT.NORMAL);
	}
	g.setFont(new Font(this.getDisplay(), fd));
	Point textPt = g.textExtent(this.meLabel);			
	g.drawText(this.meLabel, (width-textPt.x)/2, (height-textPt.y)/2);
}
 
开发者ID:avoCADo-3d,项目名称:avoCADo,代码行数:24,代码来源:MELabel.java

示例10: FontShop

import org.eclipse.swt.graphics.Font; //导入依赖的package包/类
public FontShop(Display display) {
    if (display == null) {
        Application.report("font display null");
    }

    regFonts = new Font[kNumFonts];
    boldFonts = new Font[kNumFonts];
    italicFonts = new Font[kNumFonts];
    for (int x = 0; x < kNumFonts; x++) {
        regFonts[x] = newDefaultFont(x);
        newStyledFont(x);
    }

    if (curFonts == null)
        curFonts = this;

}
 
开发者ID:openaudible,项目名称:openaudible,代码行数:18,代码来源:FontShop.java

示例11: applyCellDefaultStyles

import org.eclipse.swt.graphics.Font; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private RankedItem<T> applyCellDefaultStyles(final ColumnOptions<T> options, ViewerCell cell) {
	final RankedItem<T> rankedItem = (RankedItem<T>) cell.getElement();
	cell.setForeground(fromRegistry(options.getFontColor()));
	int rowState = rowStateResolver.apply(rankedItem);
	
    if ((rowState & RowState.SELECTED.value) != 0 && options.isEnableBackgroundSelection()) {
		cell.setBackground(fromRegistry(new RGB(225,226,206)));
	} else {
		cell.setBackground(fromRegistry(options.getBackgroundColor()));
	}
    if ((rowState & RowState.CURSOR.value) != 0 && options.isEnableBackgroundSelection()) {
		cell.setBackground(fromRegistry(ColorUtil.blend(cell.getBackground().getRGB(), new RGB(200,200,200))));
    }
	Font font = createColumnFont(options, cell);
	cell.setFont(font);
	return rankedItem;
}
 
开发者ID:dakaraphi,项目名称:eclipse-plugin-commander,代码行数:19,代码来源:KaviListColumns.java

示例12: createStyledText

import org.eclipse.swt.graphics.Font; //导入依赖的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

示例13: initializeViewer

import org.eclipse.swt.graphics.Font; //导入依赖的package包/类
private void initializeViewer(IDocument document) {
	fAnnotationPreferences = EditorsPlugin.getDefault().getMarkerAnnotationPreferences();
	setDocument(document);
	installViewerConfiguration();
	setEditable(true);
	Font font = JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT);
	getTextWidget().setFont(font);
	getTextWidget().setData("document",document);
	Control control = getControl();
	GridData data = new GridData(GridData.FILL_BOTH);
	control.setLayoutData(data);
	prependVerifyKeyListener(new VerifyKeyListener() {

		@Override
		public void verifyKey(VerifyEvent event) {
			handleVerifyKeyPressed(event);
		}
	});
	addDocumentListener(document);
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:21,代码来源:SourceViewer.java

示例14: CommentBoxFigure

import org.eclipse.swt.graphics.Font; //导入依赖的package包/类
/**
 * Creates a new CommentBoxFigure with a MarginBorder that is the given size and a FlowPage containing a TextFlow
 * with the style WORD_WRAP_SOFT.
 * 
 * @param borderSize
 *            the size of the MarginBorder
 */
public CommentBoxFigure(int borderSize) {
	setBorder(new MarginBorder(5));
	FlowPage flowPage = new FlowPage();

	textFlow = new TextFlow();

	textFlow.setLayoutManager(new ParagraphTextLayout(textFlow, ParagraphTextLayout.WORD_WRAP_SOFT));

	flowPage.add(textFlow);

	setLayoutManager(new StackLayout());
	add(flowPage);
	font = new Font(Display.getDefault(), "Arial", 9, SWT.NORMAL);
	setFont(font);
	setForegroundColor(ColorConstants.black);
	setOpaque(false);

}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:26,代码来源:CommentBoxFigure.java

示例15: updateScaledFont

import org.eclipse.swt.graphics.Font; //导入依赖的package包/类
/**
 * update scaledFonts
 * @param zoom
 * 				at zoom 
 */
private void updateScaledFont(double zoom) {
	if (cachedZoom == zoom)
		return;
	
	Text text = (Text)getCellEditor().getControl();
	Font font = getEditPart().getFigure().getFont();
	
	disposeScaledFont();
	cachedZoom = zoom;
	if (zoom == 1.0)
		text.setFont(font);
	else {
		FontData fd = font.getFontData()[0];
		fd.setHeight((int)(fd.getHeight() * zoom));
		text.setFont(scaledFont = new Font(null, fd));
	}
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:23,代码来源:CommentBoxLabelEditManager.java


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