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


Java SWT.ITALIC属性代码示例

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


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

示例1: draw

@Override
public void draw(int paintX, int paintSpaceLeadingX, int paintY, GC gc) {
	StyledText styledText = getTextViewer().getTextWidget();
	Rectangle client = styledText.getClientArea();
	gc.setBackground(styledText.getDisplay().getSystemColor(SWT.COLOR_WHITE));
	styledText.drawBackground(gc, paintX, paintY, client.width, this.getHeightInPx());

	gc.setForeground(styledText.getDisplay().getSystemColor(SWT.COLOR_GRAY));

	Font font = new Font(styledText.getDisplay(), "Arial", 9, SWT.ITALIC);
	gc.setFont(font);
	String text = getText(gc, paintSpaceLeadingX);
	if (text != null) {
		int y = paintY + 4;
		gc.drawText(text, paintSpaceLeadingX, y);

		if (hoveredCodeLensEndX != null) {
			Point extent = gc.textExtent(text);
			gc.drawLine(hoveredCodeLensStartX, y + extent.y - 1, hoveredCodeLensEndX, y + extent.y - 1);
		}
	}
}
 
开发者ID:angelozerr,项目名称:codelens-eclipse,代码行数:22,代码来源:CodeLensViewZone.java

示例2: draw

@Override
public void draw(int paintX, int paintSpaceLeadingX, int paintY, GC gc) {
	StyledText styledText = super.getTextViewer().getTextWidget();
	Rectangle client = styledText.getClientArea();
	gc.setBackground(styledText.getDisplay().getSystemColor(SWT.COLOR_WHITE));
	styledText.drawBackground(gc, paintX, paintY, client.width, super.getHeightInPx());
	gc.setForeground(styledText.getDisplay().getSystemColor(SWT.COLOR_GRAY));

	Font font = new Font(styledText.getDisplay(), "Arial", 9, SWT.ITALIC);
	gc.setFont(font);
	gc.drawText(this.getText(), paintX, paintY + 4);
}
 
开发者ID:angelozerr,项目名称:codelens-eclipse,代码行数:12,代码来源:DefaultViewZone.java

示例3: getTextAttribute

private TextAttribute getTextAttribute(IPreferenceStore prefs, SQLEditorStatementTypes type) {
    SQLEditorSyntaxModel sm = new SQLEditorSyntaxModel(type, prefs).load();
    int style = 0 | (sm.isBold() ? SWT.BOLD : 0)
            | (sm.isItalic() ? SWT.ITALIC: 0)
            | (sm.isUnderline() ? SWT.UNDERLINE_SINGLE: 0)
            | (sm.isUnderline() ? TextAttribute.UNDERLINE: 0)
            | (sm.isStrikethrough() ? TextAttribute.STRIKETHROUGH: 0);
    return new TextAttribute(fSharedColors.getColor(sm.getColor()), null, style);
}
 
开发者ID:pgcodekeeper,项目名称:pgcodekeeper,代码行数:9,代码来源:SQLEditorSourceViewerConfiguration.java

示例4: attachNote

private void attachNote(final Composite container) {
	Label lblParameterGridNote=new Label(container, SWT.NONE);
	FontData fontData = lblParameterGridNote.getFont().getFontData()[0];
	Font font = new Font(lblParameterGridNote.getDisplay(), new FontData(fontData.getName(), fontData
	    .getHeight(), SWT.ITALIC));
	lblParameterGridNote.setText("Note - New parameters will be visible only after you save the job.");
	lblParameterGridNote.setFont(font);
	
	if(!visibleParameterGirdNote)
		lblParameterGridNote.setVisible(false);
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:11,代码来源:ParameterGridDialog.java

示例5: italic

public ColumnOptions<T> italic() {
	fontStyle = SWT.ITALIC;
	return this;
}
 
开发者ID:dakaraphi,项目名称:eclipse-plugin-commander,代码行数:4,代码来源:ColumnOptions.java

示例6: toAwtFont

/**
 * Create an awt font by converting as much information 
 * as possible from the provided swt <code>FontData</code>.
 * <p>Generally speaking, given a font size, an swt font will 
 * display differently on the screen than the corresponding awt 
 * one. Because the SWT toolkit use native graphical ressources whenever 
 * it is possible, this fact is plateform dependent. To address 
 * this issue, it is possible to enforce the method to return 
 * an awt font with the same height as the swt one.
 * 
 * @param device The swt device being drawn on (display or gc device).
 * @param fontData The swt font to convert.
 * @param ensureSameSize A boolean used to enforce the same size 
 * (in pixels) between the swt font and the newly created awt font.
 * @return An awt font converted from the provided swt font.
 */
public static java.awt.Font toAwtFont(Device device, FontData fontData, 
        boolean ensureSameSize) {
    int style;
    switch (fontData.getStyle()) {
        case SWT.NORMAL:
            style = java.awt.Font.PLAIN;
            break;
        case SWT.ITALIC:
            style = java.awt.Font.ITALIC;
            break;
        case SWT.BOLD:
            style = java.awt.Font.BOLD;
            break;
        default:
            style = java.awt.Font.PLAIN;
            break;
    }
    int height = (int) Math.round(fontData.getHeight() * device.getDPI().y 
            / 72.0);
    // hack to ensure the newly created awt fonts will be rendered with the
    // same height as the swt one
    if (ensureSameSize) {
        GC tmpGC = new GC(device);
        Font tmpFont = new Font(device, fontData);
        tmpGC.setFont(tmpFont);
        JPanel DUMMY_PANEL = new JPanel();
        java.awt.Font tmpAwtFont = new java.awt.Font(fontData.getName(), 
                style, height);
        if (DUMMY_PANEL.getFontMetrics(tmpAwtFont).stringWidth(Az) 
                > tmpGC.textExtent(Az).x) {
            while (DUMMY_PANEL.getFontMetrics(tmpAwtFont).stringWidth(Az) 
                    > tmpGC.textExtent(Az).x) {
                height--;                
                tmpAwtFont = new java.awt.Font(fontData.getName(), style, 
                        height);
            }
        }
        else if (DUMMY_PANEL.getFontMetrics(tmpAwtFont).stringWidth(Az) 
                < tmpGC.textExtent(Az).x) {
            while (DUMMY_PANEL.getFontMetrics(tmpAwtFont).stringWidth(Az) 
                    < tmpGC.textExtent(Az).x) {
                height++;
                tmpAwtFont = new java.awt.Font(fontData.getName(), style, 
                        height);
            }
        }
        tmpFont.dispose();
        tmpGC.dispose();
    }
    return new java.awt.Font(fontData.getName(), style, height);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:67,代码来源:SWTUtils.java


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