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


Java FontData类代码示例

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


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

示例1: createFont

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

示例2: 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

示例3: addStats

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

示例4: 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

示例5: fillTipArea

import org.eclipse.swt.graphics.FontData; //导入依赖的package包/类
private void fillTipArea() {
	if (TipDayEx.fontName == null) {
		final FontData[] fontData = Display.getDefault().getSystemFont()
				.getFontData();
		if (fontData != null && fontData.length > 0) {
			TipDayEx.fontName = String.format("\"%s\"", fontData[0].getName());
		} else {
			TipDayEx.fontName = "Arial,​\"Helvetica Neue\",​Helvetica,​sans-serif";
		}
	}
	String text = String.format(
			"<html><body bgcolor=\"#EFEFEF\" text=\"#000000\" style='font-family:%s;font-size=14px\'>%s</body></html>",
			TipDayEx.fontName, this.tips.get(TipDayEx.index));
	// System.err.println(text);
	this.tipArea.setText(text);
}
 
开发者ID:sergueik,项目名称:SWET,代码行数:17,代码来源:TipDayEx.java

示例6: fillTipArea

import org.eclipse.swt.graphics.FontData; //导入依赖的package包/类
private void fillTipArea() {
	if (TipDayEx.fontName == null) {
		final FontData[] fontData = Display.getDefault().getSystemFont()
				.getFontData();
		if (fontData != null && fontData.length > 0) {
			TipDayEx.fontName = String.format("\"%s\"", fontData[0].getName());
		} else {
			TipDayEx.fontName = "Arial,​\"Helvetica Neue\",​Helvetica,​sans-serif";
		}
	}
	String text = String.format(
			"<html><body bgcolor=\"#EFEFEF\" text=\"#000000\" style='font-family:%s;font-size=14px\'>%s</body></html>",
			TipDayEx.fontName, this.tips.get(TipDayEx.index));
	System.err.println(text);
	this.tipArea.setText(text);
}
 
开发者ID:sergueik,项目名称:SWET,代码行数:17,代码来源:TipDayEx.java

示例7: addSelectionListeneronToFontButton

import org.eclipse.swt.graphics.FontData; //导入依赖的package包/类
private void addSelectionListeneronToFontButton(Button fontButton, TableEditor fontEditor) {
	fontButton.addSelectionListener(new SelectionAdapter() {

		@Override
		public void widgetSelected(SelectionEvent e) {
			String fontdata = "";
			dialog = new FontDialog(Display.getCurrent().getActiveShell(), SWT.NONE);
			dialog.setText("Select Font");
			String string = formatMap.get(excelFormats[4]);
			fontdata = checkDefaultValue(fontEditor, fontdata, string);
			RGB checkDefaultColor = checkDefaultColor(fontdata, string);
			dialog.setRGB(checkDefaultColor);
			FontData defaultFont = new FontData(fontdata);
			dialog.setFontData(defaultFont);
			FontData newFont = dialog.open();
			RGB rgb = dialog.getRGB();
			String convertRGBToHEX = convertRGBToHEX(rgb);
			if (newFont != null) {
				fontEditor.getItem().setText(1, newFont.toString() + "|" + convertRGBToHEX);

			}
		}

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

示例8: updateScaledFont

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

示例9: getStyleSheet

import org.eclipse.swt.graphics.FontData; //导入依赖的package包/类
protected String getStyleSheet() {
	if (fgStyleSheet == null)
		fgStyleSheet = loadStyleSheet();
	String css = fgStyleSheet;
	if (css != null) {
		FontData fontData = JFaceResources.getFontRegistry().getFontData(
				fontSymbolicName)[0];
		css = HTMLPrinter.convertTopLevelFont(css, fontData);
	}
	return css;
}
 
开发者ID:Yakindu,项目名称:solidity-ide,代码行数:12,代码来源:CustomCSSHelpHoverProvider.java

示例10: getFont

import org.eclipse.swt.graphics.FontData; //导入依赖的package包/类
/** {@inheritDoc} */
public Font getFont() {
    if (curFont != null) {
        int style = Font.PLAIN;

        final FontData[] fd = curFont.getFontData();
        if (fd.length > 0) {
            if ((fd[0].getStyle() & SWT.BOLD) != 0) {
                style = style | Font.BOLD;
            }
            if ((fd[0].getStyle() & SWT.ITALIC) != 0) {
                style = style | SWT.ITALIC;
            }

            return new Font(fd[0].getName(), style, fd[0].getHeight());
        }
        return null;
    }
    else {
        return null;
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:23,代码来源:SWTGraphics2D.java

示例11: initButton

import org.eclipse.swt.graphics.FontData; //导入依赖的package包/类
private Button initButton(Pair<Integer, String> c) {
		Button b = new Button(this, SWT.PUSH);
		
		FontData[] fD = b.getFont().getFontData();
		fD[0].setHeight(16);
//		b.setFont( new Font(getDisplay(), fD[0]));
		b.setFont(Fonts.createFont(fD[0]));
		
		String text = c.getRight();
		Integer code = c.getLeft();
		
//		b.setText(Character.toString(c));
//		b.setToolTipText(Character.getName(c));
		
		//Character tmp = c.toCharArray()[0];
		b.setText(text);
		b.setToolTipText(Character.getName(code));
		
		b.addSelectionListener(btnSelectionListener);
		
		return b;
	}
 
开发者ID:Transkribus,项目名称:TranskribusSwtGui,代码行数:23,代码来源:VirtualKeyboard.java

示例12: createExampleLabel

import org.eclipse.swt.graphics.FontData; //导入依赖的package包/类
public static Label createExampleLabel(Composite composite, String title,
		int span) {
	Label label = new Label(composite, SWT.NONE);
	label.setText(ResourceString.getResourceString(title));

	if (span > 0) {
		GridData gridData = new GridData();
		gridData.horizontalSpan = span;
		label.setLayoutData(gridData);
	}

	FontData fontData = Display.getCurrent().getSystemFont().getFontData()[0];
	Font font = Resources.getFont(fontData.getName(), 8);
	label.setFont(font);

	return label;
}
 
开发者ID:kozake,项目名称:ermaster-k,代码行数:18,代码来源:CompositeFactory.java

示例13: setTextControlFont

import org.eclipse.swt.graphics.FontData; //导入依赖的package包/类
private void setTextControlFont(final Text text) {
    final FontData[] tahomaFontData = getShell().getDisplay().getFontList("Tahoma", true); //$NON-NLS-1$
    if (tahomaFontData != null && tahomaFontData.length > 0) {
        historyFont = new Font(getShell().getDisplay(), "Tahoma", 10, SWT.NORMAL); //$NON-NLS-1$
    }

    if (historyFont != null) {
        text.setFont(historyFont);
    }

    addDisposeListener(new DisposeListener() {
        @Override
        public void widgetDisposed(final DisposeEvent e) {
            if (historyFont != null) {
                historyFont.dispose();
            }
        }
    });
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:20,代码来源:WorkItemHistoryControl.java

示例14: configureMacOSX

import org.eclipse.swt.graphics.FontData; //导入依赖的package包/类
private void configureMacOSX() {
    final FontData fontData = font.getFontData()[0];
    fontData.setHeight(11);
    font.dispose();
    font = new Font(getDisplay(), fontData);

    final FontData fontBoldData = fontBold.getFontData()[0];
    fontBoldData.setHeight(11);
    fontBold.dispose();
    fontBold = new Font(getDisplay(), fontBoldData);

    setBackground(getDisplay().getSystemColor(SWT.COLOR_WHITE));

    spacing = new Point(0, 2);

    weekdayStringLength = 1;
    dayAlignment = SWT.RIGHT;
    drawOtherDays = false;
}
 
开发者ID:Microsoft,项目名称:team-explorer-everywhere,代码行数:20,代码来源:Datepicker.java

示例15: convertFont

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


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