本文整理汇总了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);
}
示例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);
}
示例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();
});
}
示例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 ) );
}
示例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);
}
示例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));
}
示例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);
}
示例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(" ", " "));
subText.setBackground(new Color(display, 255, 255, 255));
subText.setMargins(30, 0, 0, 0);
}
}
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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));
}
}