congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
Font
Code IndexAdd Tabnine to your IDE (free)

How to use
Font
in
org.eclipse.swt.graphics

Best Java code snippets using org.eclipse.swt.graphics.Font (Showing top 20 results out of 918)

Refine searchRefine arrow

  • FontData
  • Display
  • Label
  • Shell
  • Composite
  • GC
  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
List l =
  • Codota Iconnew ArrayList()
  • Codota Iconnew LinkedList()
  • Smart code suggestions by Tabnine
}
origin: pentaho/pentaho-kettle

 return;
gc.setBackground( (Color) object );
gc.fillRectangle( canvas.getClientArea() );
return;
if ( ( (Font) object ).isDisposed() ) {
 return;
gc.setFont( (Font) object );
FontData[] array = gc.getFont().getFontData();
String string = "";
String lf = text.getLineDelimiter();
 FontData data = array[i];
 String style = "NORMAL";
 int bits = data.getStyle();
 if ( bits != 0 ) {
  if ( ( bits & SWT.BOLD ) != 0 ) {
 string += data.getName() + " " + data.getHeight() + " " + style + lf;
gc.drawString( string, 0, 0 );
origin: pentaho/pentaho-kettle

protected Splash( Display display, Shell splashShell ) throws KettleException {
 log = new LogChannel( Spoon.APP_NAME );
 Rectangle displayBounds = display.getPrimaryMonitor().getBounds();
 verFont = new Font( display, "Helvetica", 11, SWT.BOLD );
 licFont = new Font( display, "Helvetica", licFontSize, SWT.NORMAL );
 devWarningFont = new Font( display, "Helvetica", 10, SWT.NORMAL );
 splash.setImage( kettle_icon );
 splash.setText( BaseMessages.getString( PKG, "SplashDialog.Title" ) ); // "Pentaho Data Integration"
 splash.addPaintListener( new PaintListener() {
  public void paintControl( PaintEvent e ) {
   StringBuilder sb = new StringBuilder();
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

/**
 * Free the managed resource if it hasn't already been done and if this is not a system font
 *
 */
public void dispose() {
 // System color and already disposed off colors don't need to be disposed!
 if ( !systemFont && !font.isDisposed() ) {
  font.dispose();
 }
}
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 widgetSelected( SelectionEvent arg0 ) {
  graphFont.dispose();
  graphFontData = props.getDefaultFontData();
  graphFont = new Font( display, graphFontData );
  wGFont.redraw();
 }
} );
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.platform/org.eclipse.jface.text

fMessageText= new Label(fProposalShell, SWT.RIGHT);
GridData textData= new GridData(SWT.FILL, SWT.BOTTOM, true, false);
fMessageText.setLayoutData(textData);
fMessageText.setText(fContentAssistant.getStatusMessage() + " "); //$NON-NLS-1$
if (fMessageTextFont == null) {
  Font font= fMessageText.getFont();
  Display display= fProposalShell.getDisplay();
  FontData[] fontDatas= font.getFontData();
  for (FontData fontData : fontDatas)
    fontData.setHeight(fontData.getHeight() * 9 / 10);
  fMessageTextFont= new Font(display, fontDatas);
fMessageText.setFont(fMessageTextFont);
  fMessageText.setCursor(fProposalShell.getDisplay().getSystemCursor(SWT.CURSOR_HAND));
  fMessageText.addMouseListener(new MouseAdapter() {
    @Override
origin: org.eclipse/org.eclipse.wst.xsd.ui

PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, XSDEditorCSHelpIds.REGEX_TEST_PAGE);
matchLabel = new Label(composite, SWT.WRAP);
matchLabel.setText(XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_TESTING_PAGE_DESCRIPTION"));
FontData[] fontData = matchLabel.getFont().getFontData();
GridData dataF = new GridData();
dataF.widthHint = 400;
dataF.heightHint = 6 * fontData[0].getHeight();
matchLabel.setLayoutData(dataF);
Composite controls = new Composite(composite, SWT.NONE);
GridLayout controlsLayout = new GridLayout();
controlsLayout.numColumns = 2;
controls.setLayout(controlsLayout);
controls.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
new Label(controls, SWT.LEFT).setText(XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_REGEX_LABEL"));
Label separator = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
GC gc = new GC(separator);
Point pointSize = gc.stringExtent(XSDEditorPlugin.getXSDString("_UI_REGEX_WIZARD_TESTING_PAGE_DESCRIPTION"));
GridData gd = new GridData();
gd.widthHint = pointSize.x / 2 + gc.getAdvanceWidth('M')*11;
gd.horizontalAlignment= GridData.FILL;
separator.setLayoutData(gd);
origin: org.eclipse.platform/org.eclipse.jface.text

private void createStatusLabel(final String statusFieldText, Color foreground, Color background) {
  fStatusLabel= new Label(fStatusComposite, SWT.RIGHT);
  fStatusLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
  fStatusLabel.setText(statusFieldText);
  FontData[] fontDatas= JFaceResources.getDialogFont().getFontData();
  for (FontData fontData : fontDatas) {
    fontData.setHeight(fontData.getHeight() * 9 / 10);
  }
  fStatusLabelFont= new Font(fStatusLabel.getDisplay(), fontDatas);
  fStatusLabel.setFont(fStatusLabelFont);
  setStatusLabelColors(foreground, background);
  setColor(fStatusComposite, foreground, background);
}
origin: pentaho/pentaho-kettle

private void createDialog( String title, String url, int options, Image logo ) {
 display = parent.getDisplay();
 dialog = new Shell( parent, options );
 dialog.setText( title );
 dialog.setImage( logo );
 PropsUI props = PropsUI.getInstance();
  Label helpButton = new Label( dialog, SWT.NONE );
  helpButton.setImage( new Image( display, GoogleAuthorizationDialog.class.getResourceAsStream( "/images/help.png" ) ) );
  FormData helpButtonFormData = new FormData();
  helpButtonFormData.left = new FormAttachment( 0, 15 );
  helpButtonFormData.bottom = new FormAttachment( 100, -24 );
  helpButton.setLayoutData( helpButtonFormData );
  helpLabel.setFont( new Font( display, "Open Sans Regular", 11, SWT.NORMAL ) );
  helpLabel.setForeground( new Color( display, 0, 94, 170 ) );
  FormData helpLabelFormData = new FormData();
origin: inspectIT/inspectIT

/**
 * {@inheritDoc}
 */
@Override
public void createPartControl(Composite parent, FormToolkit toolkit) {
  composite = toolkit.createComposite(parent);
  composite.setLayout(new GridLayout(1, false));
  Composite innerComposite = toolkit.createComposite(composite);
  innerComposite.setLayout(new GridLayout(2, false));
  innerComposite.setLayoutData(new GridData(SWT.CENTER, SWT.TOP, true, true));
  Label labelIcon = toolkit.createLabel(innerComposite, "");
  labelIcon.setImage(Display.getCurrent().getSystemImage(SWT.ICON_WARNING));
  labelIcon.setLayoutData(new GridData(SWT.CENTER, SWT.FILL, true, true));
  Label labelInfoText = toolkit.createLabel(innerComposite, INFO_TEXT);
  FontData fontData = labelInfoText.getFont().getFontData()[0];
  Font font = new Font(Display.getCurrent(), new FontData(fontData.getName(), fontData.getHeight(), SWT.BOLD));
  labelInfoText.setFont(font);
  labelInfoText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
}
origin: tvrenamer/tvrenamer

Label iconLabel = new Label(aboutShell, SWT.NONE);
GridData iconGridData = new GridData();
iconGridData.verticalAlignment = GridData.FILL;
iconGridData.grabExcessVerticalSpace = false;
iconGridData.grabExcessHorizontalSpace = false;
iconLabel.setLayoutData(iconGridData);
iconLabel.setImage(UIStarter.readImageFromPath(APPLICATION_ICON_PATH));
Label applicationLabel = new Label(aboutShell, SWT.NONE);
FontData defaultFont = ui.getDefaultSystemFont();
applicationLabel.setFont(new Font(aboutShell.getDisplay(), defaultFont.getName(),
  defaultFont.getHeight() + 4, SWT.BOLD));
applicationLabel.setText(APPLICATION_NAME);
applicationLabel.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, true, true));
Label versionLabel = new Label(aboutShell, SWT.NONE);
versionLabel.setFont(new Font(aboutShell.getDisplay(),
               defaultFont.getName(),
               defaultFont.getHeight() + 2,
               SWT.BOLD));
origin: org.eclipse.mylyn.commons/screenshots

private Image createFontImage(FontData fontData, RGB rgb, boolean select) {
  Display display = parent.getDisplay();
  Color ButtonFace = display.getSystemColor((select)
      ? SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW
      : SWT.COLOR_WIDGET_BACKGROUND);
  int x = 16, y = 16;
  Image image = new Image(display, x, y);
  GC gc = new GC(image);
  gc.setBackground(ButtonFace);
  gc.fillRectangle(0, 0, x, y);
  String label = "A"; //$NON-NLS-1$
  gc.setFont(new Font(display, new FontData(fontData.getName(), 11, fontData.getStyle())));
  gc.setForeground(new Color(display, rgb));
  Point sz = gc.textExtent(label);
  gc.drawText(label, (x - sz.x) / 2, (y - sz.y) / 2 + 1, true);
  gc.dispose();
  return image;
}
origin: org.eclipse/org.eclipse.ui.editors

private boolean useHeightHint(Composite parent) {
  int fontHeight= (parent.getFont().getFontData())[0].getHeight();
  int displayHeight= parent.getDisplay().getClientArea().height;
  return (displayHeight / fontHeight) > 50;
}
origin: org.eclipse.jdt/org.eclipse.jdt.ui

public PixelConverter(Font font) {
  GC gc = new GC(font.getDevice());
  gc.setFont(font);
  fFontMetrics= gc.getFontMetrics();
  gc.dispose();
}
origin: ystrot/glance

protected void applyFonts(final Composite composite) {
  Dialog.applyDialogFont(composite);
  if (info != null) {
    final Font font = info.getFont();
    final FontData[] fontDatas = font.getFontData();
    for (int i = 0; i < fontDatas.length; i++) {
      fontDatas[i].setHeight(fontDatas[i].getHeight() * 9 / 10);
    }
    infoFont = new Font(info.getDisplay(), fontDatas);
    info.setFont(infoFont);
  }
}
origin: rinde/RinSim

final Rectangle displayBounds = parent.getDisplay().getBounds();
 parent.getShell().getBounds().width - MARGIN * 2;
label = new Label(group, SWT.NONE);
final Font f = label.getFont();
final FontData[] fontData = f.getFontData();
for (int i = 0; i < fontData.length; i++) {
 fontData[i].setHeight(NEXT_BUTTON_FONT_SIZE);
final Font newFont = new Font(parent.getDisplay(), fontData);
label.setFont(newFont);
});
next.setFont(newFont);
newFont.dispose();
group.layout();
update();
origin: stackoverflow.com

 Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new GridLayout());
Label label = new Label(shell, SWT.NONE);
label.setText("I am italic");
FontData fontData = label.getFont().getFontData()[0];
Font font = new Font(display, new FontData(fontData.getName(), fontData
  .getHeight(), SWT.ITALIC));
label.setFont(font);
shell.open();
while (!shell.isDisposed()) {
 if (!display.readAndDispatch())
  display.sleep();
}
font.dispose();
display.dispose();
origin: org.eclipse.jdt/org.eclipse.jdt.ui

private void changeFont(Control control, boolean italic) {
  Display.getCurrent().asyncExec(() -> {
    FontData fd= control.getFont().getFontData()[0];
    int style= italic ? (fd.getStyle() | SWT.ITALIC) : (fd.getStyle() & ~SWT.ITALIC);
    control.setFont(new Font(control.getDisplay(), new FontData(fd.getName(), fd.getHeight(), style)));
    if (control instanceof Composite)
      ((Composite) control).layout();
  });
}
org.eclipse.swt.graphicsFont

Javadoc

Instances of this class manage operating system resources that define how text looks when it is displayed. Fonts may be constructed by providing a device and either name, size and style information or a FontData object which encapsulates this data.

Application code must explicitly invoke the Font.dispose() method to release the operating system resources managed by each instance when those instances are no longer required.

Most used methods

  • getFontData
    Returns an array of FontDatas representing the receiver. On Windows, only one FontData will be retur
  • <init>
  • dispose
  • isDisposed
    Returns true if the font has been disposed, and false otherwise. This method gets the dispose state
  • equals
    Compares the argument to the receiver, and returns true if they represent the same object using a c
  • getDevice
  • hashCode
    Returns an integer hash code for the receiver. Any two objects that return true when passed toequal
  • init
  • gtk_new
    Invokes platform specific functionality to allocate a new font.IMPORTANT: This method is not part of
  • addTraits
  • checkDevice
  • cocoa_new
    Invokes platform specific functionality to allocate a new font.IMPORTANT: This method is not part of
  • checkDevice,
  • cocoa_new,
  • findFontData,
  • win32_new

Popular in Java

  • Making http requests using okhttp
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • compareTo (BigDecimal)
  • startActivity (Activity)
  • ResultSet (java.sql)
    An interface for an object which represents a database table entry, returned as the result of the qu
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • PriorityQueue (java.util)
    A PriorityQueue holds elements on a priority heap, which orders the elements according to their natu
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • JButton (javax.swing)
  • Table (org.hibernate.mapping)
    A relational table
  • 21 Best Atom Packages for 2021
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now