本文整理匯總了Java中org.eclipse.swt.widgets.Label.setFont方法的典型用法代碼示例。如果您正苦於以下問題:Java Label.setFont方法的具體用法?Java Label.setFont怎麽用?Java Label.setFont使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.Label
的用法示例。
在下文中一共展示了Label.setFont方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createTopContent
import org.eclipse.swt.widgets.Label; //導入方法依賴的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();
});
}
示例2: initialize
import org.eclipse.swt.widgets.Label; //導入方法依賴的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));
}
示例3: createContents
import org.eclipse.swt.widgets.Label; //導入方法依賴的package包/類
private void createContents(String str) {
aboutToolsShell = new Shell(getParent(), getStyle());
aboutToolsShell.setImage(SWTResourceManager.getImage(ShortcutKeyExplain.class, Resource.IMAGE_ICON));
aboutToolsShell.setSize(400, 391);
aboutToolsShell.setText(getText());
PubUtils.setCenterinParent(getParent(), aboutToolsShell);
Link link = new Link(aboutToolsShell, SWT.NONE);
link.setBounds(143, 336, 108, 17);
link.setText("<a>www.itlaborer.com</a>");
link.addSelectionListener(new LinkSelection());
StyledText readMeTextLabel = new StyledText(aboutToolsShell,
SWT.BORDER | SWT.READ_ONLY | SWT.WRAP | SWT.V_SCROLL);
readMeTextLabel.setBounds(3, 33, 389, 297);
readMeTextLabel.setText(str);
Label label_2 = new Label(aboutToolsShell, SWT.NONE);
label_2.setFont(org.eclipse.wb.swt.SWTResourceManager.getFont("微軟雅黑", 9, SWT.BOLD));
label_2.setText("快捷鍵說明:");
label_2.setBounds(3, 12, 136, 17);
}
示例4: createButtonBar
import org.eclipse.swt.widgets.Label; //導入方法依賴的package包/類
@Override
protected Control createButtonBar(Composite parent) {
final Composite buttonBar = (Composite) super.createButtonBar(parent);
errorLabel = new Label(buttonBar, SWT.LEFT);
errorLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, true, 1, 1));
errorLabel.setText("There are no defined remote functions");
errorLabel.setForeground(display.getSystemColor(SWT.COLOR_RED));
errorLabel.setVisible(false);
errorLabel.setFont(topFont);
errorLabel.moveAbove(super.buttonControl);
return buttonBar;
}
示例5: createButtonBar
import org.eclipse.swt.widgets.Label; //導入方法依賴的package包/類
@Override
protected Control createButtonBar(Composite parent) {
final Composite buttonBar = (Composite) super.createButtonBar(parent);
errorLabel = new Label(buttonBar, SWT.LEFT);
errorLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
errorLabel.setText("The provided credentials are invalid");
errorLabel.setForeground(display.getSystemColor(SWT.COLOR_RED));
errorLabel.setVisible(false);
errorLabel.setFont(topFont);
errorLabel.moveAbove(super.buttonControl);
return buttonBar;
}
示例6: createControl
import org.eclipse.swt.widgets.Label; //導入方法依賴的package包/類
@Override
public void createControl(Composite parent) {
// project specification group
Composite composite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
composite.setLayout(layout);
composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// new project label
Label label = new Label(composite, SWT.NONE);
label.setText("Language name");
label.setFont(parent.getFont());
// new project name entry field
_nameField = new Text(composite, SWT.BORDER);
GridData data = new GridData(GridData.FILL_HORIZONTAL);
data.widthHint = SIZING_TEXT_FIELD_WIDTH;
_nameField.setLayoutData(data);
_nameField.setFont(parent.getFont());
// Set the initial value first before listener
// to avoid handling an event during the creation.
if (_initialLanguageName != null) {
_nameField.setText(_initialLanguageName);
}
_nameField.addListener(SWT.Modify, nameModifyListener);
BidiUtils.applyBidiProcessing(_nameField, BidiUtils.BTD_DEFAULT);
setControl(composite);
}
示例7: createNewFilePage
import org.eclipse.swt.widgets.Label; //導入方法依賴的package包/類
@Override
protected WizardNewFileCreationPage createNewFilePage() {
return new NewFilePage(getSelection(), fileExt) {
@Override
public void createControl(Composite parent) {
super.createControl(parent);
Composite control = (Composite) getControl();
Composite extensionGroup = new Composite(control, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
extensionGroup.setLayout(layout);
extensionGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Label refOccieLabel = new Label(extensionGroup, SWT.NONE);
refOccieLabel.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, true));
refOccieLabel.setText(Messages.NewExtensionWizard_RefExtensionLabel);
refOccieLabel.setFont(parent.getFont());
Composite composite = new Composite(extensionGroup, SWT.NULL);
GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
composite.setLayoutData(layoutData);
TableColumnLayout tableLayout = new TableColumnLayout();
composite.setLayout(tableLayout);
Table table = new Table(composite,
SWT.CHECK | SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
refExtensionViewer = new CheckboxTableViewer(table);
refExtensionViewer.setContentProvider(ArrayContentProvider.getInstance());
Collection<String> registeredExtensions = new ArrayList<String>(
OcciRegistry.getInstance().getRegisteredExtensions());
refExtensionViewer.setInput(registeredExtensions);
}
};
}
示例8: attachNote
import org.eclipse.swt.widgets.Label; //導入方法依賴的package包/類
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);
}
示例9: createConsoleBufferWidget
import org.eclipse.swt.widgets.Label; //導入方法依賴的package包/類
/**
* Create console buffer widget
* @param bufferSize
*/
private void createConsoleBufferWidget(String bufferSize){
HydroGroup hydroGroup = new HydroGroup(this, SWT.NONE);
hydroGroup.setHydroGroupText(Messages.HYDROGRAPH_CONSOLE_PREFERANCE_PAGE_GROUP_NAME);
hydroGroup.setLayout(new GridLayout(1, false));
hydroGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
hydroGroup.getHydroGroupClientArea().setLayout(new GridLayout(2, false));
Label label = new Label(hydroGroup.getHydroGroupClientArea(), SWT.NONE);
label.setText(Messages.PREFERANCE_CONSOLE_BUFFER_SIZE);
textWidget = new Text(hydroGroup.getHydroGroupClientArea(), SWT.BORDER);
textWidget.setText(bufferSize);
textWidget.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
textWidget.setTextLimit(6);
attachConsoleBufferValidator();
Composite purgeComposite = new Composite(hydroGroup.getHydroGroupClientArea(), SWT.NONE);
purgeComposite.setLayout(new GridLayout(2, false));
purgeComposite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1));
Label lblNote = new Label(purgeComposite, SWT.TOP | SWT.WRAP);
lblNote.setText(Messages.PREFERANCE_PAGE_NOTE);
FontData fontData = lblNote.getFont().getFontData()[0];
Font font = new Font(purgeComposite.getDisplay(), new FontData(fontData.getName(), fontData.getHeight(), SWT.BOLD));
lblNote.setFont(font);
Label lblmsg = new Label(purgeComposite, SWT.TOP | SWT.WRAP);
lblmsg.setText(Messages.UI_PERFORMANCE_NOTE_IN_CASE_OF_CHANGE_IN_BUFFER_SIZE);
}
示例10: populateHeader
import org.eclipse.swt.widgets.Label; //導入方法依賴的package包/類
private void populateHeader(Composite header) {
header.setBackground(Colors.getSystemColor(display, SWT.COLOR_WHITE));
title = new Label(header, SWT.WRAP);
title.setFont(titleFont);
FillLayout layout = new FillLayout();
layout.marginHeight = 10;
layout.marginWidth = 10;
header.setLayout(layout);
}
示例11: createStatsView
import org.eclipse.swt.widgets.Label; //導入方法依賴的package包/類
private GridComposite createStatsView(GridComposite parent) {
GridComposite c = null;
if (true) {
c = new GridComposite(parent, SWT.BORDER_DOT);
c.initLayout(2, false, GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_HORIZONTAL);
c.noMargins();
c.getGridData().horizontalIndent = 0;
c.getGridData().verticalIndent = 0;
// c.debugLayout(SWT.COLOR_BLUE);
} else {
c = parent;
}
for (BookElement s : elems) {
String labelName = getName(s);
Label l = c.newLabel();
l.setText(Translate.getInstance().labelName(labelName) + ": ");
l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
l.setFont(FontShop.tableFontBold());
l.setBackground(bgColor);
Label d = c.newLabel();
d.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
d.setFont(FontShop.tableFont());
d.setBackground(bgColor);
d.setData(s);
stats[s.ordinal()] = d;
}
return c;
}
示例12: StatusPanel
import org.eclipse.swt.widgets.Label; //導入方法依賴的package包/類
StatusPanel(Composite c) {
super(c, SWT.NONE);
initLayout(2, false, GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
BookNotifier.getInstance().addListener(this);
ConnectionNotifier.getInstance().addListener(this);
Status elems[] = Status.values();
stats = new Label[elems.length];
for (int x = 0; x < elems.length; x++) {
if (!elems[x].display())
continue;
String labelName = elems[x].displayName();
Label l = newLabel();
l.setText(Translate.getInstance().labelName(labelName) + ": ");
l.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
l.setFont(FontShop.tableFontBold());
l.setBackground(bgColor);
Label d = newLabel();
GridData gd = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
// gd.widthHint=120;
d.setLayoutData(gd);
d.setFont(FontShop.tableFont());
d.setBackground(bgColor);
d.setData(elems[x]);
stats[x] = d;
}
_update();
}
示例13: createPartControl
import org.eclipse.swt.widgets.Label; //導入方法依賴的package包/類
@Override
public void createPartControl(Composite parent) {
FillLayout fillLayout = new FillLayout(SWT.VERTICAL);
fillLayout.marginHeight = 5;
fillLayout.marginWidth = 5;
parent.setLayout(fillLayout);
// main container
container = new Composite(parent, SWT.BORDER);
container.setLayout(new FillLayout());
// create container for stack trace data
Composite stacktraceDataContainer = new Composite(parent, SWT.BORDER);
FormLayout formLayout = new FormLayout();
formLayout.marginHeight = 5;
formLayout.marginWidth = 5;
formLayout.spacing = 5;
stacktraceDataContainer.setLayout(formLayout);
Composite stackLabelContainer = new Composite(stacktraceDataContainer, SWT.NO_SCROLL | SWT.SHADOW_NONE);
stackLabelContainer.setLayout(new GridLayout());
FormData stackLabelFormData = new FormData();
stackLabelFormData.top = new FormAttachment(0);
stackLabelFormData.left = new FormAttachment(0);
stackLabelFormData.right = new FormAttachment(100);
stackLabelFormData.bottom = new FormAttachment(20);
stackLabelContainer.setLayoutData(stackLabelFormData);
Composite stackTraceContainer = new Composite(stacktraceDataContainer, SWT.NO_SCROLL | SWT.SHADOW_NONE);
stackTraceContainer.setLayout(new FillLayout());
FormData stackTraceFormData = new FormData();
stackTraceFormData.top = new FormAttachment(stackLabelContainer);
stackTraceFormData.left = new FormAttachment(0);
stackTraceFormData.right = new FormAttachment(100);
stackTraceFormData.bottom = new FormAttachment(100);
stackTraceContainer.setLayoutData(stackTraceFormData);
// Create viewer for test tree in main container
testTreeViewer = new TreeViewer(container);
testTreeViewer.setContentProvider(new XpectContentProvider());
testTreeViewer.setLabelProvider(new XpectLabelProvider(this.testsExecutionStatus));
testTreeViewer.setInput(null);
// create stack trace label
stacktraceLabel = new Label(stackLabelContainer, SWT.SHADOW_OUT);
FontData fontData = stacktraceLabel.getFont().getFontData()[0];
Display display = Display.getCurrent();
// may be null if outside the UI thread
if (display == null)
display = Display.getDefault();
Font font = new Font(display, new FontData(fontData.getName(), fontData
.getHeight(), SWT.BOLD));
// Make stack trace label bold
stacktraceLabel.setFont(font);
stacktraceLabel.setText(NO_TRACE_MSG);
// create stack trace console
MessageConsole messageConsole = new MessageConsole("trace", null);
stacktraceConsole = new TraceConsole(messageConsole);
stacktraceConsoleViewer = new TextConsoleViewer(stackTraceContainer, messageConsole);
// context menu
getSite().setSelectionProvider(testTreeViewer);
MenuManager contextMenu = new MenuManager();
contextMenu.setRemoveAllWhenShown(true);
getSite().registerContextMenu(contextMenu, testTreeViewer);
Control control = testTreeViewer.getControl();
Menu menu = contextMenu.createContextMenu(control);
control.setMenu(menu);
activateContext();
createSelectionActions();
}
示例14: createDescriptionLabel
import org.eclipse.swt.widgets.Label; //導入方法依賴的package包/類
/** copied from PropertyAndPreferencePage */
@Override
protected Label createDescriptionLabel(Composite parent) {
parentComposite = parent;
if (isProjectPreferencePage()) {
Composite composite = new Composite(parent, SWT.NONE);
composite.setFont(parent.getFont());
GridLayout layout = new GridLayout();
layout.marginHeight = 0;
layout.marginWidth = 0;
layout.numColumns = 2;
composite.setLayout(layout);
composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
IDialogFieldListener listener = new IDialogFieldListener() {
@Override
public void dialogFieldChanged(DialogField dialogField) {
boolean enabled = ((SelectionButtonDialogField) dialogField).isSelected();
enableProjectSpecificSettings(enabled);
projectSpecificChanged = true;
if (enabled && getData() != null) {
applyData(getData());
}
}
};
useProjectSettings = new SelectionButtonDialogField(SWT.CHECK);
useProjectSettings.setDialogFieldListener(listener);
useProjectSettings
.setLabelText(org.eclipse.xtext.ui.preferences.Messages.PropertyAndPreferencePage_useprojectsettings_label);
useProjectSettings.doFillIntoGrid(composite, 1);
LayoutUtil.setHorizontalGrabbing(useProjectSettings.getSelectionButton(null));
if (offerLink()) {
changeWorkspaceSettings = createLink(composite,
org.eclipse.xtext.ui.preferences.Messages.PropertyAndPreferencePage_useworkspacesettings_change);
changeWorkspaceSettings.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
} else {
LayoutUtil.setHorizontalSpan(useProjectSettings.getSelectionButton(null), 2);
}
Label horizontalLine = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
horizontalLine.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1));
horizontalLine.setFont(composite.getFont());
} else if (supportsProjectSpecificOptions() && offerLink()) {
changeWorkspaceSettings = createLink(
parent,
org.eclipse.xtext.ui.preferences.Messages.PropertyAndPreferencePage_showprojectspecificsettings_label);
changeWorkspaceSettings.setLayoutData(new GridData(SWT.END, SWT.CENTER, true, false));
}
return super.createDescriptionLabel(parent);
}
示例15: createControl
import org.eclipse.swt.widgets.Label; //導入方法依賴的package包/類
@Override
public void createControl(Composite parent) {
super.createControl(parent);
Composite control = (Composite) getControl();
Composite extensionGroup = new Composite(control, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
extensionGroup.setLayout(layout);
extensionGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Label refOccieLabel = new Label(extensionGroup, SWT.NONE);
refOccieLabel.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, true));
refOccieLabel.setText(Messages.NewConnectorWizard_RefExtensionLabel);
refOccieLabel.setFont(parent.getFont());
Composite composite = new Composite(extensionGroup, SWT.NULL);
GridData layoutData = new GridData(SWT.FILL, SWT.FILL, true, true);
composite.setLayoutData(layoutData);
TableColumnLayout tableLayout = new TableColumnLayout();
composite.setLayout(tableLayout);
Table table = new Table(composite,
SWT.CHECK | SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
refExtensionViewer = new CheckboxTableViewer(table);
refExtensionViewer.setContentProvider(ArrayContentProvider.getInstance());
refExtensionViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
setPageComplete(validatePage());
}
});
Collection<String> registeredExtensions = new ArrayList<String>(
OcciRegistry.getInstance().getRegisteredExtensions());
// removed the OCCI core extension as it is added by default.
registeredExtensions.remove(OcciCoreConstants.OCCI_CORE_SCHEME);
refExtensionViewer.setInput(registeredExtensions);
}