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);
}
java类org.eclipse.swt.graphics.Font的实例源码
TableFigure.java 文件源码
项目:bdf2
阅读 29
收藏 0
点赞 0
评论 0
PluginsSWT.java 文件源码
项目:ide-plugins
阅读 29
收藏 0
点赞 0
评论 0
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);
}
PluginDialog.java 文件源码
项目:ide-plugins
阅读 36
收藏 0
点赞 0
评论 0
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();
});
}
TitleRenderer.java 文件源码
项目:neoscada
阅读 25
收藏 0
点赞 0
评论 0
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 ) );
}
TextEditorComposite.java 文件源码
项目:convertigo-eclipse
阅读 30
收藏 0
点赞 0
评论 0
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);
}
SqlQueryEditorComposite.java 文件源码
项目:convertigo-eclipse
阅读 23
收藏 0
点赞 0
评论 0
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));
}
ViewLabelProvider.java 文件源码
项目:convertigo-eclipse
阅读 32
收藏 0
点赞 0
评论 0
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);
}
StatisticsDialog.java 文件源码
项目:convertigo-eclipse
阅读 31
收藏 0
点赞 0
评论 0
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);
}
}
}
MELabel.java 文件源码
项目:avoCADo
阅读 30
收藏 0
点赞 0
评论 0
@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);
}
FontShop.java 文件源码
项目:openaudible
阅读 30
收藏 0
点赞 0
评论 0
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;
}
KaviListColumns.java 文件源码
项目:eclipse-plugin-commander
阅读 23
收藏 0
点赞 0
评论 0
@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;
}
ScrolledTextEx.java 文件源码
项目:SWET
阅读 24
收藏 0
点赞 0
评论 0
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;
}
SourceViewer.java 文件源码
项目:Hydrograph
阅读 29
收藏 0
点赞 0
评论 0
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);
}
CommentBoxFigure.java 文件源码
项目:Hydrograph
阅读 27
收藏 0
点赞 0
评论 0
/**
* 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);
}
CommentBoxLabelEditManager.java 文件源码
项目:Hydrograph
阅读 24
收藏 0
点赞 0
评论 0
/**
* 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));
}
}
LaunchConfigurationMainTab.java 文件源码
项目:n4js
阅读 26
收藏 0
点赞 0
评论 0
@SuppressWarnings("javadoc")
public static Composite createComposite(Composite parent, Font font, int columns, int hspan, int fill) {
Composite g = new Composite(parent, SWT.NONE);
g.setLayout(new GridLayout(columns, false));
g.setFont(font);
GridData gd = new GridData(fill);
gd.horizontalSpan = hspan;
g.setLayoutData(gd);
return g;
}
OpenTypeSelectionDialog.java 文件源码
项目:n4js
阅读 31
收藏 0
点赞 0
评论 0
@Override
public Font get() {
final Font font = getDialogArea().getFont();
final FontData[] data = font.getFontData();
for (int i = 0; i < data.length; i++) {
data[i].setStyle(BOLD);
}
return new Font(font.getDevice(), data);
}
OpenTypeSelectionDialog.java 文件源码
项目:n4js
阅读 36
收藏 0
点赞 0
评论 0
@Override
public void dispose() {
super.dispose();
if (null != boldFontSupplier) {
final Font font = boldFontSupplier.get();
if (null != font && !font.isDisposed()) {
font.dispose();
}
}
}
SubscriptionWizard.java 文件源码
项目:BiglyBT
阅读 34
收藏 0
点赞 0
评论 0
private void createFonts() {
FontData[] fDatas = shell.getFont().getFontData();
for(int i = 0 ; i < fDatas.length ; i++) {
fDatas[i].setStyle(SWT.BOLD);
}
boldFont = new Font(display,fDatas);
for(int i = 0 ; i < fDatas.length ; i++) {
if(com.biglybt.core.util.Constants.isOSX) {
fDatas[i].setHeight(12);
} else {
fDatas[i].setHeight(10);
}
}
subTitleFont = new Font(display,fDatas);
for(int i = 0 ; i < fDatas.length ; i++) {
if(com.biglybt.core.util.Constants.isOSX) {
fDatas[i].setHeight(17);
} else {
fDatas[i].setHeight(14);
}
}
titleFont = new Font(display,fDatas);
// When GTK3 can show a textbox without a border, we can remove the logic
textInputFont = FontUtils.getFontWithHeight(shell.getFont(), null, Utils.isGTK3 ? 12 : 14);
}
ExportSelectionPage.java 文件源码
项目:n4js
阅读 29
收藏 0
点赞 0
评论 0
@Override
protected void createOptionsGroupButtons(Group optionsGroup) {
Font font = optionsGroup.getFont();
optionsGroup.setLayout(new GridLayout(2, true));
Composite left = new Composite(optionsGroup, SWT.NONE);
left.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false));
left.setLayout(new GridLayout(1, true));
// compress... checkbox
compressContentsCheckbox = new Button(left, SWT.CHECK | SWT.LEFT);
compressContentsCheckbox.setText(DataTransferMessages.ZipExport_compressContents);
compressContentsCheckbox.setFont(font);
}
AbstractLaunchConfigurationMainTab.java 文件源码
项目:n4js
阅读 27
收藏 0
点赞 0
评论 0
/**
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
*/
@Override
public void createControl(Composite parent) {
Font font = parent.getFont();
Composite comp = createComposite(parent, font, 1, 1, GridData.FILL_BOTH);
createResourceGroup(comp);
createImplementationIdGroup(comp);
setControl(comp);
}
PluginsSWT.java 文件源码
项目:ide-plugins
阅读 29
收藏 0
点赞 0
评论 0
private Font loadCustomFont(int fontSize) {
String fontPath = ProjectUtils.extractResourceToTmp("fontawesome-webfont.ttf");
boolean isLoaded = display.loadFont(fontPath);
if (isLoaded) {
return Stream.of(Display.getDefault().getFontList(null, true))
.filter(fd -> fd.getName().toLowerCase(Locale.ROOT).contains("fontawesome"))
.findFirst()
.map(fd -> {
fd.setHeight(fontSize);
return new Font(display, fd);
})
.orElse(null);
}
return null;
}
PluginDialog.java 文件源码
项目:ide-plugins
阅读 28
收藏 0
点赞 0
评论 0
public PluginDialog(Shell shell) {
super(shell);
this.display = Display.getDefault();
fontName = display.getSystemFont().getFontData()[0].getName();
backColor = new Color(display, 244, 244, 244);
rowColorSelection = display.getSystemColor(SWT.COLOR_WHITE);
titleFont = new Font(display, fontName, getTitleFontSize(), SWT.NORMAL);
topFont = new Font(display, fontName, getTopFontSize(), SWT.NORMAL);
}
LaunchConfigurationMainTab.java 文件源码
项目:gemoc-studio-modeldebugging
阅读 22
收藏 0
点赞 0
评论 0
/***
* Create the Field where user enters the language used to execute
*
* @param parent container composite
* @param font used font
* @return the created composite containing the fields
*/
public Composite createLanguageLayout(Composite parent, Font font) {
// Language
createTextLabelLayout(parent, "Melange languages");
_languageCombo = new Combo(parent, SWT.NONE);
_languageCombo.setLayoutData(createStandardLayout());
List<String> languagesNames = MelangeHelper.getAllLanguages();
String[] empty = {};
_languageCombo.setItems(languagesNames.toArray(empty));
_languageCombo.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
//String selection = _languageCombo.getText();
//List<String> modelTypeNames = MelangeHelper.getModelTypes(selection);
updateLaunchConfigurationDialog();
}
});
createTextLabelLayout(parent, "");
createTextLabelLayout(parent, "Melange resource adapter query");
_melangeQueryText = new Text(parent, SWT.SINGLE | SWT.BORDER);
_melangeQueryText.setLayoutData(createStandardLayout());
_melangeQueryText.setFont(font);
_melangeQueryText.setEditable(false);
createTextLabelLayout(parent, "");
return parent;
}
DecoratingColumLabelProvider.java 文件源码
项目:gemoc-studio-modeldebugging
阅读 35
收藏 0
点赞 0
评论 0
@Override
public Font getFont(Object element) {
final Font res;
if (fontProvider == null) {
res = null;
} else {
res = fontProvider.getFont(element);
}
return res;
}
DecoratingColumLabelProvider.java 文件源码
项目:gemoc-studio-modeldebugging
阅读 35
收藏 0
点赞 0
评论 0
@Override
public Font getToolTipFont(Object element) {
final Font res;
if (cellLabelProvider == null) {
res = null;
} else {
res = cellLabelProvider.getToolTipFont(element);
}
return res;
}
EnginesStatusView.java 文件源码
项目:gemoc-studio-modeldebugging
阅读 27
收藏 0
点赞 0
评论 0
/**
* This is a callback that will allow us
* to create the viewer and initialize it.
*/
public void createPartControl(Composite parent) {
_viewer = new TreeViewer(parent, SWT.FULL_SELECTION | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
_contentProvider = new ViewContentProvider();
_viewer.setContentProvider(_contentProvider);
ColumnViewerToolTipSupport.enableFor(_viewer);
_viewer.addSelectionChangedListener(
new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
fireEngineSelectionChanged();
}
});
createColumns();
// _viewer.setColumnProperties( new String[] {"Status", "Identifier", "Step", "Status"} );
// _viewer.getTree().setHeaderVisible(true);
Font mono = JFaceResources.getFont(JFaceResources.TEXT_FONT);
_viewer.getTree().setFont(mono);
// Create the help context id for the viewer's control
PlatformUI.getWorkbench().getHelpSystem().setHelp(_viewer.getControl(), "org.eclipse.gemoc.executionframework.ui.views.engine.EngineStatusView");
// register for changes in the RunningEngineRegistry
//org.eclipse.gemoc.executionframework.engine.Activator.getDefault().gemocRunningEngineRegistry.addObserver(this);
buildMenu();
org.eclipse.gemoc.executionframework.engine.Activator.getDefault().gemocRunningEngineRegistry.addEngineRegistrationListener(this);
}
FontShop.java 文件源码
项目:openaudible
阅读 36
收藏 0
点赞 0
评论 0
private Font newStyledFont(int index, int style) {
Font f = regFonts[index];
if (isset(f)) {
FontData[] fontData = f.getFontData();
fontData[0].setStyle(style);
fontData[0].setLocale(Translate.getLocale().toString());
return new Font(Display.getDefault(), fontData);
} else {
Application.report("newBold failed. f=" + f);
}
return null;
}
TreeNodeLabelProvider.java 文件源码
项目:neoscada
阅读 34
收藏 0
点赞 0
评论 0
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 );
}
TreeNodeLabelProvider.java 文件源码
项目:neoscada
阅读 33
收藏 0
点赞 0
评论 0
@Override
public Font getFont ( final Object element )
{
final TreeNode node = (TreeNode)element;
if ( node.isProviderSet () )
{
return this.defaultFont;
}
else
{
return this.font;
}
}