org.eclipse.ui.forms.widgets.Hyperlink.setFont()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(220)

本文整理了Java中org.eclipse.ui.forms.widgets.Hyperlink.setFont()方法的一些代码示例,展示了Hyperlink.setFont()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Hyperlink.setFont()方法的具体详情如下:
包路径:org.eclipse.ui.forms.widgets.Hyperlink
类名称:Hyperlink
方法名:setFont

Hyperlink.setFont介绍

暂无

代码示例

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.intro

private Hyperlink createStaticPage(Composite parent) {
  Form mainForm = toolkit.createForm(parent);
  Composite body = mainForm.getBody();
  GridLayout gl = new GridLayout();
  body.setLayout(gl);
  String label = Messages.StaticHTML_welcome;
  Hyperlink link = toolkit.createHyperlink(body, label, SWT.WRAP);
  link.setFont(PageStyleManager.getHeaderFont());
  GridData gd = new GridData(GridData.GRAB_HORIZONTAL
      | GridData.GRAB_VERTICAL);
  gd.horizontalAlignment = GridData.CENTER;
  gd.verticalAlignment = GridData.CENTER;
  link.setLayoutData(gd);
  link.addHyperlinkListener(new HyperlinkAdapter() {
    @Override
    public void linkActivated(HyperlinkEvent e) {
      Hyperlink link = (Hyperlink) e.getSource();
      Util.openBrowser((String) link.getHref());
      return;
    }
  });
  return link;
}

代码示例来源:origin: org.eclipse/org.eclipse.wst.xsd.ui

protected Control createInfoTextArea(Composite parent)
{
 Composite infoComposite = new Composite(parent, SWT.NONE);
 GridLayout gridLayout = new GridLayout(2, false);
 gridLayout.marginHeight = 0;
 gridLayout.marginWidth = 0;
 infoComposite.setLayout(gridLayout);
 GridData gd = new GridData(GridData.FILL_BOTH);
 infoComposite.setLayoutData(gd);
 nsInfoLabel = new Label(infoComposite, SWT.LEFT);
 nsInfoLabel.setText(infoText);
 Font font = nsInfoLabel.getFont();
 FontData[] fontDatas = font.getFontData();
 for (int i = 0; i < fontDatas.length; i++)
 {
  fontDatas[i].setHeight(fontDatas[i].getHeight() * 9 / 10);
 }
 infoFont = new Font(nsInfoLabel.getDisplay(), fontDatas);
 nsInfoLabel.setFont(infoFont);
 gd = new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING);
 nsInfoLabel.setLayoutData(gd);
 nsInfoLabel.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW));
 link = new Hyperlink(infoComposite, SWT.RIGHT);
 link.setText(Messages._UI_ACTION_OPEN_IN_NEW_EDITOR);
 link.setFont(infoFont);
 link.addHyperlinkListener(linkListener);
 return infoComposite;
}

代码示例来源:origin: org.eclipse.egit/ui

private void createHeadLink(final Repository repository, Composite composite) throws IOException {
  final ObjectId objectId = repository
      .resolve(repository.getFullBranch());
  if (objectId == null) {
    Text headLabel = createLabeledReadOnlyText(composite, UIText.GitProjectPropertyPage_LabelId);
    if (repository.getAllRefs().size() == 0)
      headLabel.setText(UIText.GitProjectPropertyPage_ValueEmptyRepository);
    else
      headLabel.setText(UIText.GitProjectPropertyPage_ValueUnbornBranch);
  } else {
    Hyperlink headLink = createHeadHyperLink(composite, UIText.GitProjectPropertyPage_LabelId);
    headLink.setText(objectId.name());
    headLink.setUnderlined(true);
    headLink.setFont(JFaceResources.getDialogFont());
    headLink.setForeground(JFaceColors.getHyperlinkText(headLink
        .getDisplay()));
    headLink.addHyperlinkListener(new HyperlinkAdapter() {
      @Override
      public void linkActivated(HyperlinkEvent e) {
        RepositoryCommit commit = getCommit(repository, objectId);
        if(commit != null)
          CommitEditor.openQuiet(commit);
      }
    });
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.intro

linkControl.setFont(PageStyleManager.getBannerFont());
colorControl(linkControl, link);
linkControl.setHref(link.getUrl());

相关文章