本文整理匯總了Java中org.eclipse.swt.widgets.Link.setFont方法的典型用法代碼示例。如果您正苦於以下問題:Java Link.setFont方法的具體用法?Java Link.setFont怎麽用?Java Link.setFont使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.swt.widgets.Link
的用法示例。
在下文中一共展示了Link.setFont方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createControl
import org.eclipse.swt.widgets.Link; //導入方法依賴的package包/類
public Control createControl(Composite composite) {
fGroup= new Group(composite, SWT.NONE);
fGroup.setFont(composite.getFont());
fGroup.setLayout(initGridLayout(new GridLayout(2, false), true));
fGroup.setText(NewWizardMessages.NewJavaProjectWizardPageOne_JREGroup_title);
fUseEEJRE.doFillIntoGrid(fGroup, 1);
Combo eeComboControl= fEECombo.getComboControl(fGroup);
eeComboControl.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
fUseProjectJRE.doFillIntoGrid(fGroup, 1);
Combo comboControl= fJRECombo.getComboControl(fGroup);
comboControl.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
fUseDefaultJRE.doFillIntoGrid(fGroup, 1);
fPreferenceLink= new Link(fGroup, SWT.NONE);
fPreferenceLink.setFont(fGroup.getFont());
fPreferenceLink.setText(NewWizardMessages.NewJavaProjectWizardPageOne_JREGroup_link_description);
fPreferenceLink.setLayoutData(new GridData(GridData.END, GridData.CENTER, false, false));
fPreferenceLink.addSelectionListener(this);
updateEnableState();
return fGroup;
}
示例2: createLinkControl
import org.eclipse.swt.widgets.Link; //導入方法依賴的package包/類
private Control createLinkControl(Composite composite) {
Link link= new Link(composite, SWT.WRAP | SWT.RIGHT);
link.setText(DialogsMessages.SortMembersMessageDialog_description);
link.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
openMembersSortOrderPage();
}
});
link.setToolTipText(DialogsMessages.SortMembersMessageDialog_link_tooltip);
GridData gridData= new GridData(GridData.FILL, GridData.CENTER, true, false);
gridData.widthHint= convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);//convertWidthInCharsToPixels(60);
link.setLayoutData(gridData);
link.setFont(composite.getFont());
return link;
}
示例3: addLink
import org.eclipse.swt.widgets.Link; //導入方法依賴的package包/類
protected Link addLink(Composite parent, String label, Key key, SelectionListener linkListener, int indent, int widthHint) {
GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
gd.horizontalSpan= 3;
gd.horizontalIndent= indent;
gd.widthHint= widthHint;
Link link= new Link(parent, SWT.NONE);
link.setFont(JFaceResources.getDialogFont());
link.setText(label);
link.setData(key);
link.setLayoutData(gd);
link.addSelectionListener(linkListener);
makeScrollableCompositeAware(link);
fLinks.add(link);
return link;
}
示例4: createContents
import org.eclipse.swt.widgets.Link; //導入方法依賴的package包/類
@Override
public Control createContents(Composite parent) {
Composite contents = new Composite(parent, SWT.NONE);
Link instructions = new Link(contents, SWT.WRAP);
instructions.setText(Messages.getString("CloudSdkRequired"));
instructions.setFont(contents.getFont());
instructions.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
WorkbenchUtil.openInBrowser(PlatformUI.getWorkbench(), event.text);
}
});
Composite fieldContents = new Composite(parent, SWT.NONE);
sdkLocation = new CloudSdkDirectoryFieldEditor(PreferenceConstants.CLOUDSDK_PATH,
Messages.getString("SdkLocation"), fieldContents);
Path defaultLocation = getDefaultSdkLocation();
if (defaultLocation != null) {
sdkLocation.setFilterPath(defaultLocation.toFile());
}
sdkLocation.setPreferenceStore(getPreferenceStore());
sdkLocation.setPropertyChangeListener(wrappedPropertyChangeListener);
GridLayoutFactory.fillDefaults().numColumns(sdkLocation.getNumberOfControls())
.generateLayout(fieldContents);
GridLayoutFactory.fillDefaults().generateLayout(contents);
Dialog.applyDialogFont(contents);
return contents;
}
示例5: createLink
import org.eclipse.swt.widgets.Link; //導入方法依賴的package包/類
public static Link createLink(Composite parent, String text, Font font, int hspan, int fill) {
Link l = new Link(parent, SWT.UNDERLINE_LINK);
l.setFont(font);
l.setText(text);
GridData gd = new GridData(fill);
gd.horizontalSpan = hspan;
l.setLayoutData(gd);
return l;
}
示例6: createLink
import org.eclipse.swt.widgets.Link; //導入方法依賴的package包/類
protected void createLink(DomainStatus status) {
link = new Link(this, SWT.NONE);
link.setFont(DOMAIN_STATUS_FONT);
link.setBackground(ColorConstants.white);
link.setText(getMessage(status));
link.setForeground(getSeverityColor(status.getSeverity()));
link.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
Program.launch(LICENCE_LINK);
}
});
}
示例7: initControl
import org.eclipse.swt.widgets.Link; //導入方法依賴的package包/類
private void initControl() {
GridLayoutFactory.fillDefaults().numColumns(3).spacing(3, 2).applyTo(this);
GridLayout layout = (GridLayout) this.getLayout();
layout.marginLeft = 7;
layout.marginTop = 2;
layout.marginBottom = 2;
Label iconLabel = new Label(this, SWT.NULL);
iconLabel.setBackground(getBackground());
GridDataFactory.swtDefaults().align(SWT.CENTER, SWT.BEGINNING).span(1, 2).applyTo(
iconLabel);
listenTo(iconLabel);
Link nameLabel = new Link(this, SWT.NONE);
nameLabel.setText(wbToolkit.getName());
nameLabel.setBackground(getBackground());
nameLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
nameLabel.setFont(getBoldFont(getFont()));
listenTo(nameLabel);
Label providerLabel = new Label(this, SWT.NONE);
providerLabel.setText(wbToolkit.getProviderDescription());
providerLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
providerLabel.setBackground(getBackground());
providerLabel.setForeground(Display.getDefault().getSystemColor(
SWT.COLOR_GRAY));
listenTo(providerLabel);
Label summaryLabel = new Label(this, SWT.WRAP);
String description = stripCRLF(wbToolkit.getDescription());
summaryLabel.setText(description);
summaryLabel.setBackground(getBackground());
GridDataFactory.fillDefaults().grab(true, false).span(2, 1).hint(100,
SWT.DEFAULT).applyTo(summaryLabel);
listenTo(summaryLabel);
listenTo(this);
}
示例8: createContents
import org.eclipse.swt.widgets.Link; //導入方法依賴的package包/類
@Override
protected Control createContents(final Composite parent) {
noDefaultAndApplyButton();
final Composite c = new Composite(parent, SWT.NONE);
c.setLayout(new GridLayout(1, false));
final Link link = new Link(c, SWT.NONE);
link.setText("Turn off current line highlighting <A>here</A>.");
final FontData[] fontData = link.getFont().getFontData();
for (final FontData fd : fontData) {
fd.setHeight(10);
fd.setStyle(SWT.BOLD);
}
link.setFont(new Font(getShell().getDisplay(), fontData));
link.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(final SelectionEvent e) {
final IWorkbenchPreferenceContainer container = (IWorkbenchPreferenceContainer) getContainer();
container.openPage("org.eclipse.ui.preferencePages.GeneralTextEditor", null);
}
});
folder = new TabFolder(c, SWT.NONE);
folder.setLayoutData(new GridData(GridData.FILL_BOTH));
final TabItem ti = new TabItem(folder, SWT.NONE);
ti.setText("Themes");
ti.setControl(createCategoryControl(folder));
folder.pack();
return c;
}
示例9: EntryLeftBanner
import org.eclipse.swt.widgets.Link; //導入方法依賴的package包/類
/**
* Constructor.
*
* @param parent
* parent composite
* @param keyTree
* key tree
*/
public EntryLeftBanner(Composite parent, final AbstractI18NEntry i18NEntry) {
super(parent, SWT.NONE);
RowLayout layout = new RowLayout();
setLayout(layout);
layout.marginBottom = 0;
layout.marginLeft = 0;
layout.marginRight = 0;
layout.marginTop = 0;
final IAction foldAction = new FoldingAction(i18NEntry);
new ActionButton(this, foldAction);
// Button commentButton = new Button(compos, SWT.TOGGLE);
// commentButton.setImage(UIUtils.getImage("comment.gif"));
Link localeLabel = new Link(this, SWT.NONE);
localeLabel.setFont(UIUtils.createFont(localeLabel, SWT.BOLD));
boolean isEditable = i18NEntry.isEditable();
localeLabel.setText("<a>"
+ UIUtils.getDisplayName(i18NEntry.getLocale())
+ "</a>"
+ (!isEditable ? " (" + Messages.editor_readOnly + ")" : ""));
localeLabel.setToolTipText(MessageFormat.format( Messages.editor_i18nentry_resourcelocation, new Object[] { i18NEntry.getResourceLocationLabel()}));
localeLabel.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
i18NEntry.getResourceBundleEditor().setActivePage(
i18NEntry.getLocale());
}
});
// TODO have "show country flags" in preferences.
// TODO have text aligned bottom next to flag icon.
Image countryIcon = loadCountryIcon(i18NEntry.getLocale());
if (countryIcon != null) {
Label imgLabel = new Label(this, SWT.NONE);
imgLabel.setImage(countryIcon);
}
}
示例10: EntryLeftBanner
import org.eclipse.swt.widgets.Link; //導入方法依賴的package包/類
/**
* Constructor.
* @param parent parent composite
* @param keyTree key tree
*/
public EntryLeftBanner(
Composite parent,
final I18NEntry i18NEntry) {
super(parent, SWT.NONE);
RowLayout layout = new RowLayout();
setLayout(layout);
layout.marginBottom = 0;
layout.marginLeft = 0;
layout.marginRight = 0;
layout.marginTop = 0;
final IAction foldAction = new FoldingAction(i18NEntry);
new ActionButton(this, foldAction);
// Button commentButton = new Button(compos, SWT.TOGGLE);
// commentButton.setImage(UIUtils.getImage("comment.gif"));
Link localeLabel = new Link(this, SWT.NONE);
localeLabel.setFont(UIUtils.createFont(localeLabel, SWT.BOLD));
boolean isEditable = i18NEntry.isEditable();
localeLabel.setText("<a>" + UIUtils.getDisplayName(
i18NEntry.getLocale()) + "</a>" + (!isEditable
? " (" + MessagesEditorPlugin.getString(
"editor.readOnly") + ")" : ""));
localeLabel.setToolTipText(
MessagesEditorPlugin.getString("editor.i18nentry.resourcelocation",
i18NEntry.getResourceLocationLabel())); //$NON-NLS-1$
localeLabel.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
i18NEntry.getResourceBundleEditor().setActivePage(
i18NEntry.getLocale());
}
});
//TODO have "show country flags" in preferences.
//TODO have text aligned bottom next to flag icon.
Image countryIcon = loadCountryIcon(i18NEntry.getLocale());
if (countryIcon != null) {
Label imgLabel = new Label(this, SWT.NONE);
imgLabel.setImage(countryIcon);
}
}
示例11: openSaveListenerWarningDialog
import org.eclipse.swt.widgets.Link; //導入方法依賴的package包/類
/**
* Opens a warning dialog informing about a failure during handling of save listeners.
*
* @param title the dialog title
* @param message the message to display
* @param exception the exception to handle
* @since 3.4
*/
private void openSaveListenerWarningDialog(String title, String message, CoreException exception) {
final String linkText;
final IJavaProject javaProject= getInputJavaElement().getJavaProject();
IProject project= javaProject != null ? javaProject.getProject() : null;
final boolean hasProjectSettings= project != null && CleanUpPreferenceUtil.hasSettingsInScope(new ProjectScope(project));
if (exception.getStatus().getCode() == IJavaStatusConstants.EDITOR_POST_SAVE_NOTIFICATION) {
message= JavaEditorMessages.CompilationUnitEditor_error_saving_participant_message;
if (hasProjectSettings)
linkText= JavaEditorMessages.CompilationUnitEditor_error_saving_participant_property_link;
else
linkText= JavaEditorMessages.CompilationUnitEditor_error_saving_participant_link;
} else {
message= JavaEditorMessages.CompilationUnitEditor_error_saving_editedLines_calculation_message;
if (hasProjectSettings)
linkText= JavaEditorMessages.CompilationUnitEditor_error_saving_editedLines_calculation_property_link;
else
linkText= JavaEditorMessages.CompilationUnitEditor_error_saving_editedLines_calculation_link;
}
IStatus status= exception.getStatus();
int mask= IStatus.WARNING | IStatus.ERROR;
ErrorDialog dialog= new ErrorDialog(getSite().getShell(), title, message, status, mask) {
@Override
protected Control createMessageArea(Composite parent) {
Control result= super.createMessageArea(parent);
// Panic code: use 'parent' instead of 'result' in case super implementation changes in the future
new Label(parent, SWT.NONE); // filler as parent has 2 columns (icon and label)
Link link= new Link(parent, SWT.NONE);
link.setText(linkText);
link.setFont(parent.getFont());
link.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (hasProjectSettings)
PreferencesUtil.createPropertyDialogOn(getShell(), javaProject, SaveParticipantPreferencePage.PROPERTY_PAGE_ID, null, null).open();
else
PreferencesUtil.createPreferenceDialogOn(getShell(), SaveParticipantPreferencePage.PREFERENCE_PAGE_ID, null, null).open();
}
});
GridData gridData= new GridData(SWT.FILL, SWT.BEGINNING, true, false);
link.setLayoutData(gridData);
return result;
}
@Override
protected Image getImage() {
return getWarningImage();
}
};
dialog.open();
}