org.eclipse.swt.graphics.Font.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(163)

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

Font.<init>介绍

[英]Prevents uninitialized instances from being created outside the package.
[中]防止在包外部创建未初始化的实例。

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

/**
 * Create a new managed font by using fontdata
 *
 * @param display
 *          the display to use
 * @param fontData
 *          The fontdata to create the font with.
 */
public ManagedFont( Display display, FontData fontData ) {
 this.font = new Font( display, fontData );
 this.systemFont = false;
}

代码示例来源:origin: pentaho/pentaho-kettle

public void setFont( String fontName, int fontSize, boolean fontBold, boolean fontItalic ) {
 int swt = SWT.NORMAL;
 if ( fontBold ) {
  swt = SWT.BOLD;
 }
 if ( fontItalic ) {
  swt = swt | SWT.ITALIC;
 }
 Font font = new Font( PropsUI.getDisplay(), fontName, fontSize, swt );
 int index = fonts.indexOf( font );
 if ( index < 0 ) {
  fonts.add( font );
 } else {
  font.dispose();
  font = fonts.get( index );
 }
 gc.setFont( font );
}

代码示例来源:origin: pentaho/pentaho-kettle

public void setFont( String fontName, int fontSize, boolean fontBold, boolean fontItalic ) {
 int swt = SWT.NORMAL;
 if ( fontBold ) {
  swt = SWT.BOLD;
 }
 if ( fontItalic ) {
  swt = swt | SWT.ITALIC;
 }
 Font font = new Font( PropsUI.getDisplay(), fontName, fontSize, swt );
 int index = fonts.indexOf( font );
 if ( index < 0 ) {
  fonts.add( font );
 } else {
  font.dispose();
  font = fonts.get( index );
 }
 gc.setFont( font );
}

代码示例来源:origin: caoxinyu/RedisClient

font = new Font(Display.getCurrent(), fontData);
m_fontMap.put(fontName, font);

代码示例来源:origin: pentaho/pentaho-kettle

public void widgetSelected( SelectionEvent arg0 ) {
  graphFont.dispose();
  graphFontData = props.getDefaultFontData();
  graphFont = new Font( display, graphFontData );
  wGFont.redraw();
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

public void widgetSelected( SelectionEvent arg0 ) {
  noteFontData = props.getDefaultFontData();
  noteFont.dispose();
  noteFont = new Font( display, noteFontData );
  wNFont.redraw();
 }
} );

代码示例来源:origin: caoxinyu/RedisClient

/**
 * Returns a bold version of the given {@link Font}.
 * 
 * @param baseFont
 *            the {@link Font} for which a bold version is desired
 * @return the bold version of the given {@link Font}
 */
public static Font getBoldFont(Font baseFont) {
  Font font = m_fontToBoldFontMap.get(baseFont);
  if (font == null) {
    FontData fontDatas[] = baseFont.getFontData();
    FontData data = fontDatas[0];
    font = new Font(Display.getCurrent(), data.getName(), data.getHeight(), SWT.BOLD);
    m_fontToBoldFontMap.put(baseFont, font);
  }
  return font;
}
/**

代码示例来源:origin: pentaho/pentaho-kettle

public static void setGCFont( GC gc, Device device, FontData fontData ) {
 if ( Const.getOS().startsWith( "Windows" ) ) {
  Font font = new Font( device, fontData );
  gc.setFont( font );
  font.dispose();
 } else {
  gc.setFont( device.getSystemFont() );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

public void getData() {
 fixedFontData = props.getFixedFont();
 fixedFont = new Font( display, fixedFontData );
 graphFontData = props.getGraphFont();
 graphFont = new Font( display, graphFontData );
 noteFontData = props.getNoteFont();
 noteFont = new Font( display, noteFontData );
 backgroundRGB = props.getBackgroundRGB();
 if ( backgroundRGB == null ) {
  backgroundRGB = display.getSystemColor( SWT.COLOR_WIDGET_BACKGROUND ).getRGB();
 }
 background = new Color( display, backgroundRGB );
 graphColorRGB = props.getGraphColorRGB();
 graphColor = new Color( display, graphColorRGB );
 tabColorRGB = props.getTabColorRGB();
 tabColor = new Color( display, tabColorRGB );
}

代码示例来源:origin: pentaho/pentaho-kettle

public void widgetSelected( SelectionEvent arg0 ) {
  FontDialog fd = new FontDialog( shell );
  fd.setFontList( new FontData[] { graphFontData } );
  FontData newfd = fd.open();
  if ( newfd != null ) {
   graphFontData = newfd;
   graphFont.dispose();
   graphFont = new Font( display, graphFontData );
   wGFont.redraw();
  }
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

public void widgetSelected( SelectionEvent arg0 ) {
  FontDialog fd = new FontDialog( shell );
  fd.setFontList( new FontData[] { noteFontData } );
  FontData newfd = fd.open();
  if ( newfd != null ) {
   noteFontData = newfd;
   noteFont.dispose();
   noteFont = new Font( display, noteFontData );
   wNFont.redraw();
  }
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

public void widgetSelected( SelectionEvent arg0 ) {
  FontDialog fd = new FontDialog( shell );
  fd.setFontList( new FontData[] { fixedFontData } );
  FontData newfd = fd.open();
  if ( newfd != null ) {
   fixedFontData = newfd;
   fixedFont.dispose();
   fixedFont = new Font( display, fixedFontData );
   wFFont.redraw();
  }
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

private void refreshTextNote() {
  int swt = SWT.NORMAL;
  if ( wFontBold.getSelection() ) {
   swt = SWT.BOLD;
  }
  if ( wFontItalic.getSelection() ) {
   swt = swt | SWT.ITALIC;
  }
  // dispose of old font only after setting it on wDesc
  Font oldFont = font;
  font = new Font( shell.getDisplay(), wFontName.getText(), wFontSize.getSelection(), swt );
  wDesc.setFont( font );
  if ( oldFont != null && !oldFont.isDisposed() ) {
   oldFont.dispose();
  }
  for ( Control control : wDesc.getChildren() ) {
   control.setBackground( bgColor );
  }

  wFontColor.setBackground( fontColor );
  wBackGroundColor.setBackground( bgColor );
  wBorderColor.setBackground( borderColor );
 }
}

代码示例来源:origin: pentaho/pentaho-kettle

licFont.dispose();
licFont = new Font( e.display, "Helvetica", licFontSize, SWT.NORMAL );
e.gc.setFont( licFont );

代码示例来源:origin: pentaho/pentaho-kettle

verFont = new Font( display, "Helvetica", 11, SWT.BOLD );
licFont = new Font( display, "Helvetica", licFontSize, SWT.NORMAL );
devWarningFont = new Font( display, "Helvetica", 10, SWT.NORMAL );

代码示例来源:origin: pentaho/pentaho-kettle

public void widgetSelected( SelectionEvent arg0 ) {
  fixedFontData = new FontData( PropsUI.getInstance().getFixedFont().getName(),
   PropsUI.getInstance().getFixedFont().getHeight(), PropsUI.getInstance().getFixedFont().getStyle() );
  fixedFont.dispose();
  fixedFont = new Font( display, fixedFontData );
  wFFont.redraw();
 }
} );

代码示例来源:origin: pentaho/pentaho-kettle

private void setHelpLink( Display display, String helpLink, int maxTextWidth, EnvironmentCase environment ) {
 link = new Link( shell, SWT.SINGLE | SWT.WRAP );
 link.setText( helpLink );
 if ( environment == EnvironmentCase.MAC_OS_X || environment == EnvironmentCase.MAC_OS_X_THIN ) {
  FontData[] fD = link.getFont().getFontData();
  fD[0].setHeight( 13 );
  link.setFont( new Font( display, fD[0] ) );
 }
 FormData fdlink = new FormData();
 fdlink.left = new FormAttachment( warningIcon, margin ); // Link should be below description right of icon
 fdlink.top = new FormAttachment( description, margin );
 fdlink.width = maxTextWidth;
 link.setLayoutData( fdlink );
 props.setLook( link );
 link.addListener( SWT.Selection, new Listener() {
  public void handleEvent( Event event ) {
   if ( Desktop.isDesktopSupported() ) {
    try {
     Desktop.getDesktop().browse( new URI( Const.getDocUrl( URI_PATH ) ) );
    } catch ( Exception e ) {
     log.logError( "Error opening external browser", e );
    }
   }
  }
 } );
}

代码示例来源:origin: pentaho/pentaho-kettle

helpLabel.setFont( new Font( display, "Open Sans Regular", 11, SWT.NORMAL ) );
helpLabel.setForeground( new Color( display, 0, 94, 170 ) );
FormData helpLabelFormData = new FormData();

代码示例来源:origin: pentaho/pentaho-kettle

TableView.dummyGC = new GC( TableView.dummyImage );
gridFont = new Font( disp, props.getGridFont() );
TableView.dummyGC.setFont( gridFont );

代码示例来源:origin: BiglySoftware/BiglyBT

public static Font getAnyFontBoldItalic(GC gc) {
  if (fontBoldItalic == null || fontBoldItalic.isDisposed()) {
    FontData[] fontData = gc.getFont().getFontData();
    for (FontData fd : fontData) {
      fd.setStyle(SWT.BOLD | SWT.ITALIC);
    }
    fontBoldItalic = new Font(gc.getDevice(), fontData);
  }
  return fontBoldItalic;
}

相关文章