Package org.eclipse.swt.graphics

Examples of org.eclipse.swt.graphics.Font


        if (JFaceResources.BANNER_FONT.equals(event.getProperty())) {
          updateMessage();
        }
        if (JFaceResources.DIALOG_FONT.equals(event.getProperty())) {
          updateMessage();
          Font dialogFont = JFaceResources.getDialogFont();
          updateTreeFont(dialogFont);
          Control[] children = ((Composite) buttonBar).getChildren();
          for (int i = 0; i < children.length; i++) {
            children[i].setFont(dialogFont);
          }
View Full Code Here


        label.setText(message);
        data = new GridData(GridData.FILL_HORIZONTAL);
        data.heightHint = 30;
        data.widthHint = 370;

        Font f = label.getFont();
        FontData[] farr = f.getFontData();
        FontData fd = farr[0];
        fd.setStyle(SWT.BOLD);
        label.setFont(new Font(Display.getCurrent(), fd));

        label.setLayoutData(data);
        label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));

        Label labelSeparator = new Label(topComp, SWT.SEPARATOR | SWT.HORIZONTAL);
View Full Code Here

        label.setText(message);
        data = new GridData(GridData.FILL_HORIZONTAL);
        data.heightHint = 30;
        data.widthHint = 370;

        Font f = label.getFont();
        FontData[] farr = f.getFontData();
        FontData fd = farr[0];
        fd.setStyle(SWT.BOLD);
        label.setFont(new Font(Display.getCurrent(), fd));

        label.setLayoutData(data);
        label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));

        Label labelSeparator = new Label(topComp, SWT.SEPARATOR | SWT.HORIZONTAL);
View Full Code Here

        label.setText(message);
        data = new GridData(GridData.FILL_HORIZONTAL);
        data.heightHint = 30;
        data.widthHint = 370;

        Font f = label.getFont();
        FontData[] farr = f.getFontData();
        FontData fd = farr[0];
        fd.setStyle(SWT.BOLD);
        label.setFont(new Font(Display.getCurrent(), fd));

        label.setLayoutData(data);
        label.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));

        Label labelSeparator = new Label(topComp, SWT.SEPARATOR | SWT.HORIZONTAL);
View Full Code Here

   */
  public static void applyDialogFont(Control control) {
    if (control == null || dialogFontIsDefault()) {
      return;
    }
    Font dialogFont = JFaceResources.getDialogFont();
    applyDialogFont(control, dialogFont);
  }
View Full Code Here

  private static Font getDefaultFont(Control control) {
    String fontName = "DEFAULT_FONT_" + control.getClass().getName(); //$NON-NLS-1$
    if (JFaceResources.getFontRegistry().hasValueFor(fontName)) {
      return JFaceResources.getFontRegistry().get(fontName);
    }
    Font cached = control.getFont();
    control.setFont(null);
    Font defaultFont = control.getFont();
    control.setFont(cached);
    JFaceResources.getFontRegistry().put(fontName,
        defaultFont.getFontData());
    return defaultFont;
  }
View Full Code Here

   */
  private void applyFonts(Composite composite) {
    Dialog.applyDialogFont(composite);

    if (titleLabel != null) {
      Font font = titleLabel.getFont();
      FontData[] fontDatas = font.getFontData();
      for (int i = 0; i < fontDatas.length; i++) {
        fontDatas[i].setStyle(SWT.BOLD);
      }
      titleFont = new Font(titleLabel.getDisplay(), fontDatas);
      titleLabel.setFont(titleFont);
    }

    if (infoLabel != null) {
      Font font = infoLabel.getFont();
      FontData[] fontDatas = font.getFontData();
      for (int i = 0; i < fontDatas.length; i++) {
        fontDatas[i].setHeight(fontDatas[i].getHeight() * 9 / 10);
      }
      infoFont = new Font(infoLabel.getDisplay(), fontDatas);
      infoLabel.setFont(infoFont);
    }
  }
View Full Code Here

    return super.getBackground(element);
  }

  public Font getFont(Object element) {
    if (this.decorator instanceof IFontDecorator) {
      Font font = ((IFontDecorator) this.decorator).decorateFont(element);
      if (font != null)
        return font;
    }
    return super.getFont(element);
  }
View Full Code Here

    display.dispose();
  }

  @Test
  public void getFontShouldReturnTheFontFromTheInternalLabelProvider() {
    Font font = new Font(display, "Sans", 10, SWT.BOLD);
    try {
      ColumnLabelProvider p1 = mock(ColumnLabelProvider.class);
      ColumnLabelProvider p2 = mock(ColumnLabelProvider.class);
      given(p1.getFont(any())).willReturn(null);
      given(p2.getFont(any())).willReturn(font);

      CompositeCellLabelProvider provider = create(p1, p2);
      assertThat(provider.getFont(""), equalTo(font));
    } finally {
      font.dispose();
    }
  }
View Full Code Here

        fButton.setImage(fImage);
    }
   
    protected Point computeImageSize(Control window) {
        GC gc= new GC(window);
        Font f= JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT);
        gc.setFont(f);
        int height= gc.getFontMetrics().getHeight();
        gc.dispose();
        Point p= new Point(height * 3 - 6, height);
        return p;
View Full Code Here

TOP

Related Classes of org.eclipse.swt.graphics.Font

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.