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


Java FontData.setStyle方法代码示例

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


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

示例1: ViewLabelProvider

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

示例2: paintElement

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

示例3: addNoteControl

import org.eclipse.swt.graphics.FontData; //导入方法依赖的package包/类
private void addNoteControl(final Composite gridLayoutParent, final String text) {
    final Label noteLabel = new Label(gridLayoutParent, SWT.NONE);
    GridDataBuilder.newInstance().align(SWT.LEFT, SWT.TOP).applyTo(noteLabel);

    final FontData labelFontData = noteLabel.getFont().getFontData()[0];
    labelFontData.setStyle(SWT.BOLD);

    final Font boldFont = new Font(null, labelFontData);

    noteLabel.setFont(boldFont);
    noteLabel.setText(Messages.getString("MainPreferencePage.NoteText")); //$NON-NLS-1$

    final Label noteTextLabel = new Label(gridLayoutParent, SWT.WRAP);
    GridDataBuilder.newInstance().hGrab().hFill().wCHint(noteTextLabel, 30).vAlign(SWT.TOP).applyTo(noteTextLabel);
    noteTextLabel.setText(text);
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:17,代码来源:MainPreferencePage.java

示例4: setFontFromSettings

import org.eclipse.swt.graphics.FontData; //导入方法依赖的package包/类
private void setFontFromSettings() {
		if (false)
			return;
		
		FontData fd = new FontData();
		
		logger.debug("settings font name: '"+settings.getTranscriptionFontName()
				+"', size:  "+settings.getTranscriptionFontSize()+", style: "+settings.getTranscriptionFontStyle());
		
//		fd.setName(Fonts.getSystemFontName(false, false, false));
//		if (settings.getTranscriptionFontName()==null || settings.getTranscriptionFontName().isEmpty()) {
//			fd.setName(Fonts.getSystemFontName(false, false, false));	
//		} else
//			fd.setName(settings.getTranscriptionFontName());
		
		fd.setName(settings.getTranscriptionFontName());
		fd.setHeight(settings.getTranscriptionFontSize());
		fd.setStyle(settings.getTranscriptionFontStyle());
		
		logger.debug("font name = "+fd.getName());
		
		Font globalTextFont = Fonts.createFont(fd);
		text.setFont(globalTextFont);
	}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:25,代码来源:ATranscriptionWidget.java

示例5: TreeNodeLabelProvider

import org.eclipse.swt.graphics.FontData; //导入方法依赖的package包/类
public TreeNodeLabelProvider ( final TreeViewer viewer, final IObservableMap... attributeMaps )
{
    super ( attributeMaps );
    this.viewer = viewer;

    this.defaultFont = viewer.getControl ().getFont ();

    final FontData[] fds = this.viewer.getControl ().getFont ().getFontData ();
    for ( final FontData fd : fds )
    {
        fd.setStyle ( SWT.ITALIC );
    }
    this.font = new Font ( this.viewer.getControl ().getDisplay (), fds );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:15,代码来源:TreeNodeLabelProvider.java

示例6: createBoldFont

import org.eclipse.swt.graphics.FontData; //导入方法依赖的package包/类
private Font createBoldFont(Font font) {
  FontData[] fontDatas = font.getFontData();
  for (FontData fd: fontDatas) {
    fd.setStyle(SWT.BOLD);
  }
  return new Font(font.getDevice(), fontDatas);
}
 
开发者ID:alfsch,项目名称:workspacemechanic,代码行数:8,代码来源:MechanicPopup.java

示例7: createFont

import org.eclipse.swt.graphics.FontData; //导入方法依赖的package包/类
private Font createFont(final Font baseFont, final int style) {
    final FontData[] fontData = baseFont.getFontData();

    for (final FontData data : fontData) {
        data.setStyle(data.getStyle() | style);
    }

    return (new Font(getControl().getDisplay(), fontData));
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:10,代码来源:GitImportWizardSelectProjectsPage.java

示例8: ComponentTitledSeparator

import org.eclipse.swt.graphics.FontData; //导入方法依赖的package包/类
/**
 * Constructs a new instance of this class given its parent and a style
 * value describing its behavior and appearance.
 * <p>
 * The style value is either one of the style constants defined in class
 * <code>SWT</code> which is applicable to instances of this class, or must
 * be built by <em>bitwise OR</em>'ing together (that is, using the
 * <code>int</code> "|" operator) two or more of those <code>SWT</code>
 * style constants. The class description lists the style constants that are
 * applicable to the class. Style bits are also inherited from superclasses.
 * </p>
 * 
 * @param parent a composite control which will be the parent of the new
 *            instance (cannot be null)
 * @param style the style of control to construct
 * 
 * @exception IllegalArgumentException <ul>
 *                <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
 *                </ul>
 * @exception SWTException <ul>
 *                <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
 *                thread that created the parent</li>
 *                </ul>
 * 
 */
public ComponentTitledSeparator(final Composite parent, final int style) {
        super(parent, style);
        this.alignment = SWT.LEFT;

        final Color originalColor = new Color(getDisplay(), 0, 88, 150);
        setForeground(originalColor);

        final Font originalFont;
        final FontData[] fontData = getFont().getFontData();
        if (fontData != null && fontData.length > 0) {
                final FontData fd = fontData[0];
                fd.setStyle(SWT.BOLD);
                originalFont = new Font(getDisplay(), fd);
                setFont(originalFont);
        } else {
                originalFont = null;
        }

        this.addListener(SWT.Resize, new Listener() {
       
                public void handleEvent(final Event event) {
                        redrawComposite();
                }
        });

        this.addDisposeListener(new DisposeListener() {

   
            public void widgetDisposed(DisposeEvent arg0) {
                if (originalColor != null && !originalColor.isDisposed()) {
                    originalColor.dispose();
                }
                if (originalFont != null && !originalFont.isDisposed()) {
                    originalFont.dispose();
                }
            }
            
        });
}
 
开发者ID:WiednerF,项目名称:ARXPlugin,代码行数:65,代码来源:ComponentTitledSeparator.java

示例9: createBoldFont

import org.eclipse.swt.graphics.FontData; //导入方法依赖的package包/类
public static Font createBoldFont(Font f) {
	if (f.getFontData().length > 0) {
		FontData fd = f.getFontData()[0];
		fd.setStyle(SWT.BOLD);
		return createFont(fd);
	}
	return null;
}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:9,代码来源:Fonts.java

示例10: createNormalFont

import org.eclipse.swt.graphics.FontData; //导入方法依赖的package包/类
public static Font createNormalFont(Font f) {
	if (f.getFontData().length > 0) {
		FontData fd = f.getFontData()[0];
		fd.setStyle(SWT.NORMAL);
		return createFont(fd);
	}
	return null;
}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:9,代码来源:Fonts.java

示例11: changeStyleBit

import org.eclipse.swt.graphics.FontData; //导入方法依赖的package包/类
public static Font changeStyleBit(Font f, int style, boolean add) {
	if (f.getFontData().length  == 0)
		return null;
	
	FontData fd = f.getFontData()[0];
	if (add)
		fd.setStyle(fd.getStyle() | style);
	else
		fd.setStyle(fd.getStyle()  ^ style);

	return createFont(fd);
}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:13,代码来源:Fonts.java

示例12: addStyleBit

import org.eclipse.swt.graphics.FontData; //导入方法依赖的package包/类
public static Font addStyleBit(Font f, int style) {
	if (f.getFontData().length == 0)
		return null;
	
	FontData fd = f.getFontData()[0];
	fd.setStyle(fd.getStyle() | style);
	
	return createFont(fd);
}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:10,代码来源:Fonts.java

示例13: removeStyleBit

import org.eclipse.swt.graphics.FontData; //导入方法依赖的package包/类
public static Font removeStyleBit(Font f, int style) {
	if (f.getFontData().length == 0)
		return null;
	
	FontData fd = f.getFontData()[0];
	fd.setStyle(fd.getStyle() & ~style);
	
	return createFont(fd);
}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:10,代码来源:Fonts.java

示例14: createItalicFont

import org.eclipse.swt.graphics.FontData; //导入方法依赖的package包/类
public static Font createItalicFont(Font f) {
	if (f.getFontData().length > 0) {
		FontData fd = f.getFontData()[0];
		fd.setStyle(SWT.ITALIC);
		return createFont(fd);
	}
	return null;
}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:9,代码来源:Fonts.java

示例15: XYZDisplayComp

import org.eclipse.swt.graphics.FontData; //导入方法依赖的package包/类
public XYZDisplayComp(Composite parent, int style){
	super(parent, style);
	
	this.setLayout(new RowLayout(SWT.HORIZONTAL));
	this.setBackground(AvoColors.COLOR_QSET_BG);
	
	FontData fd = new FontData();
	fd.setHeight(10);
	fd.setStyle(SWT.BOLD);
	fd.setName("Verdana");
	Font f = new Font(this.getDisplay(), fd);		
	
	Label llx = new Label(this, SWT.NO_BACKGROUND);
	llx.setFont(f);
	llx.setText("X:");
	llx.setBackground(AvoColors.COLOR_QSET_BG);
	lX = new Label(this, SWT.NONE);	
	lX.setAlignment(SWT.RIGHT);
	lX.setFont(f);
	lX.setBackground(AvoColors.COLOR_QSET_BG);
	
	Label lly = new Label(this, SWT.NONE);
	lly.setFont(f);
	lly.setText(" Y:");
	lly.setBackground(AvoColors.COLOR_QSET_BG);
	lY = new Label(this, SWT.NONE);
	lY.setAlignment(SWT.RIGHT);
	lY.setFont(f);
	lY.setBackground(AvoColors.COLOR_QSET_BG);
	
	Label llz = new Label(this, SWT.NONE);
	llz.setFont(f);
	llz.setText(" Z:");
	llz.setBackground(AvoColors.COLOR_QSET_BG);
	lZ = new Label(this, SWT.NONE);
	lZ.setAlignment(SWT.RIGHT);
	lZ.setFont(f);
	lZ.setBackground(AvoColors.COLOR_QSET_BG);
	
	updateXYZ();
	
	AvoGlobal.glViewEventHandler.addGLViewListener(new GLViewListener(){
		@Override
		public void cursorMoved() {
			updateXYZ();
		}			
	});
}
 
开发者ID:avoCADo-3d,项目名称:avoCADo,代码行数:49,代码来源:XYZDisplayComp.java


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