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