Tabnine Logo
FontDialog
Code IndexAdd Tabnine to your IDE (free)

How to use
FontDialog
in
org.eclipse.swt.widgets

Best Java code snippets using org.eclipse.swt.widgets.FontDialog (Showing top 20 results out of 315)

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: org.eclipse.mylyn.commons/screenshots

public void invokeFontDialog() {
  FontData fontData = new FontData(stringCustom);
  FontDialog fontWindow = new FontDialog(parent.getShell());
  fontWindow.setFontList(new FontData[] { fontData });
  fontWindow.setRGB(int2rgb(intgerCustom));
  fontData = fontWindow.open();
  if (fontData != null) {
    intgerCustom = rgb2int(fontWindow.getRGB());
    stringCustom = fontData.toString();
    toolButton.setToolTipText(font2string(fontData));
    clickBody();
  }
}
origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

/**
 * Constructs a new instance of this class given its parent
 * and a style value describing its behavior and appearance.
 * <p>
 * The style value is either one of the style constants defined in
 * class <code>SWT</code> which is applicable to instances of this
 * class, or must be built by <em>bitwise OR</em>'ing together
 * (that is, using the <code>int</code> "|" operator) two or more
 * of those <code>SWT</code> style constants. The class description
 * lists the style constants that are applicable to the class.
 * Style bits are also inherited from superclasses.
 * </p>
 *
 * @param parent a shell which will be the parent of the new instance
 * @param style the style of dialog to construct
 *
 * @exception IllegalArgumentException <ul>
 *    <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
 * </ul>
 * @exception SWTException <ul>
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
 *    <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
 * </ul>
 */
public FontDialog (Shell parent, int style) {
  super (parent, checkStyle (parent, style));
  checkSubclass ();
}

origin: org.eclipse.platform/org.eclipse.swt.examples

FontDialog dialog = new FontDialog (shell, style);
if (usePreviousResultButton.getSelection()) {
  dialog.setFontList (fontDialogFontListResult);
  dialog.setRGB(fontDialogColorResult);
dialog.setEffectsVisible(effectsVisibleButton.getSelection());
dialog.setText (ControlExample.getResourceString("Title"));
FontData result = dialog.open ();
textWidget.append (ControlExample.getResourceString("FontDialog") + Text.DELIMITER);
textWidget.append (ControlExample.getResourceString("Result", "" + result) + Text.DELIMITER);
textWidget.append ("getFontList() =" + Text.DELIMITER);
FontData [] fonts = dialog.getFontList ();
if (fonts != null) {
  for (FontData font : fonts) {
textWidget.append ("getEffectsVisible() = " + dialog.getEffectsVisible() + Text.DELIMITER);
textWidget.append ("getRGB() = " + dialog.getRGB() + Text.DELIMITER + Text.DELIMITER);
fontDialogFontListResult = dialog.getFontList ();
fontDialogColorResult = dialog.getRGB();
return;
origin: org.eclipse.platform/org.eclipse.ui.workbench

/**
 * Edit the given font.
 *
 * @param definition
 *            the font definition
 * @param display
 *            the display to open the dialog on
 * @since 3.7
 */
private void editFont(FontDefinition definition, Display display) {
  if (definition != null) {
    final FontDialog fontDialog = new FontDialog(getShell());
    fontDialog.setEffectsVisible(false);
    fontDialog.setFontList(getFontValue(definition));
    final FontData data = fontDialog.open();
    if (data != null) {
      setFontPreferenceValue(definition, fontDialog.getFontList(), false);
      refreshElement(definition);
    }
  }
}
origin: org.eclipse.platform/org.eclipse.swt.examples

} else if (group.equals("options")) {
  tool.action = () -> {
    FontDialog fontDialog = new FontDialog(paintSurface.getShell(), SWT.PRIMARY_MODAL);
    FontData[] fontDatum = toolSettings.commonFont.getFontData();
    if (fontDatum != null && fontDatum.length > 0) {
      fontDialog.setFontList(fontDatum);
    fontDialog.setText(getResourceString("options.Font.dialog.title"));
    FontData fontData = fontDialog.open();
    paintSurface.showRubberband();
    if (fontData != null) {
origin: org.eclipse.rap/org.eclipse.rap.rwt

/**
 * Constructs a new instance of this class given its parent and a style value
 * describing its behavior and appearance.
 * <p>
 * The style value is either one of the style constants defined in class
 * <code>SWT</code> which is applicable to instances of this class, or must be
 * built by <em>bitwise OR</em>'ing together (that is, using the
 * <code>int</code> "|" operator) two or more of those <code>SWT</code> style
 * constants. The class description lists the style constants that are
 * applicable to the class. Style bits are also inherited from superclasses.
 * </p>
 *
 * @param parent a shell which will be the parent of the new instance
 * @param style the style of dialog to construct
 * @exception IllegalArgumentException <ul>
 *              <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
 *              </ul>
 * @exception SWTException <ul>
 *              <li>ERROR_THREAD_INVALID_ACCESS - if not called from the
 *              thread that created the parent</li>
 *              <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed
 *              subclass</li>
 *              </ul>
 */
public FontDialog( Shell parent, int style ) {
 super( parent, checkStyle( parent, style ) );
 checkSubclass();
 setText( RWTMessages.getMessage( "RWT_FontDialogTitle" ) );
}
origin: org.eclipse.platform/org.eclipse.swt.examples

Font oldFont = itemFont;
if (oldFont == null) oldFont = tabFolder1.getItem (0).getFont ();
fontDialog.setFontList(oldFont.getFontData());
FontData fontData = fontDialog.open ();
if (fontData == null) return;
oldFont = itemFont;
origin: org.xworker/xworker_swt

final FontDialog dialog = new FontDialog(shell);
if(self.getStringBlankAsNull("text") != null){
  dialog.setText(self.getString("text"));
  return null;
}else {
  FontData data = dialog.open();
  self.doAction("open", actionContext, UtilMap.toMap("font", data));
origin: stackoverflow.com

FontDialog fontDialog = new FontDialog();
if (fontDialog.ShowDialog() == DialogResult.OK)
origin: org.eclipse.platform/org.eclipse.swt.examples

fontDialog = new FontDialog (shell);
colorAndFontTable.addSelectionListener(widgetDefaultSelectedAdapter(event -> changeFontOrColor (colorAndFontTable.getSelectionIndex())));
changeButton.addSelectionListener(widgetSelectedAdapter(event -> changeFontOrColor (colorAndFontTable.getSelectionIndex())));
origin: stackoverflow.com

FontData data = d.open();
table.setFont(new Font(display, data));
for (int i = 0; i < titles.length; i++) {
origin: org.xworker/xworker_swt

@Override
public void dialogClosed(int returnCode) {
  FontData[] list = dialog.getFontList();
  if(list != null && list.length > 0){
    FontData fontData = list[0];
    String fontStr = fontData.getName() + "|" + fontData.getHeight() + "|" + fontData.getStyle();
    if(dialog.getRGB() != null){
      fontStr = fontStr + "|" + UtilSwt.RGBToString(dialog.getRGB());
    }
    //fontStr = fontStr;
    text.setText(fontStr);
    ///UtilSwt.setFont(text, text.getText(), null);
  }
  text.setFocus();
}
 
origin: net.sf.okapi.lib/okapi-lib-verification-ui

private void selectFont () {
  try {
    FontDialog dlg = new FontDialog(dialog);
    dlg.setText("Select Font");
    // Set current font and color info
    dlg.setFontList(opt.font.getFontData());
    dlg.setRGB(opt.foreground.getRGB());
    // Open the dialog
    FontData fontData = dlg.open();
    if ( fontData == null) return;
    
    // If not canceled by user: We assign the new font
    // Work around: For some reason disposing of the font before calling edExample.setFont()
    // with the new font is causing an invalid argument exception. So we defer the dispose.
    Font tmp = opt.font; 
    opt.font = new Font(device, fontData);
    edExample.setFont(opt.font);
    tmp.dispose();
    // And the new new color
    opt.foreground.dispose();
    opt.foreground = new Color(device, dlg.getRGB());
    updateExample();
  }
  catch ( Throwable e ) {
    Dialogs.showError(dialog, e.getLocalizedMessage(), null);
  }
}
origin: org.eclipse.swt.cocoa.macosx/x86_64

/**
 * Constructs a new instance of this class given its parent
 * and a style value describing its behavior and appearance.
 * <p>
 * The style value is either one of the style constants defined in
 * class <code>SWT</code> which is applicable to instances of this
 * class, or must be built by <em>bitwise OR</em>'ing together 
 * (that is, using the <code>int</code> "|" operator) two or more
 * of those <code>SWT</code> style constants. The class description
 * lists the style constants that are applicable to the class.
 * Style bits are also inherited from superclasses.
 * </p>
 *
 * @param parent a shell which will be the parent of the new instance
 * @param style the style of dialog to construct
 *
 * @exception IllegalArgumentException <ul>
 *    <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
 * </ul>
 * @exception SWTException <ul>
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
 *    <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
 * </ul>
 */
public FontDialog (Shell parent, int style) {
  super (parent, checkStyle (parent, style));
  checkSubclass ();
}

origin: org.eclipse.platform/org.eclipse.swt.examples

  if (controls.length > 0) oldFont = controls [0].getFont ();
if (oldFont != null) fontDialog.setFontList(oldFont.getFontData()); // seed dialog with current font
FontData fontData = fontDialog.open ();
if (fontData == null) return;
origin: org.xworker/xworker_swt

public void widgetSelected(SelectionEvent event) {
  final FontDialog dialog = new FontDialog(text.getShell());
  FontData fontData = UtilSwt.parseFontData(text.getText());
  if(fontData != null){
    dialog.setFontList(new FontData[]{fontData});
    dialog.setRGB(rgb);
    fontData = dialog.open();
    if(fontData != null){
      String fontStr = fontData.getName() + "|" + fontData.getHeight() + "|" + fontData.getStyle();
      if(dialog.getRGB() != null){
        fontStr = fontStr + "|" + UtilSwt.RGBToString(dialog.getRGB());
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: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

/**
 * Constructs a new instance of this class given its parent
 * and a style value describing its behavior and appearance.
 * <p>
 * The style value is either one of the style constants defined in
 * class <code>SWT</code> which is applicable to instances of this
 * class, or must be built by <em>bitwise OR</em>'ing together
 * (that is, using the <code>int</code> "|" operator) two or more
 * of those <code>SWT</code> style constants. The class description
 * lists the style constants that are applicable to the class.
 * Style bits are also inherited from superclasses.
 * </p>
 *
 * @param parent a shell which will be the parent of the new instance
 * @param style the style of dialog to construct
 *
 * @exception IllegalArgumentException <ul>
 *    <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
 * </ul>
 * @exception SWTException <ul>
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
 *    <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
 * </ul>
 */
public FontDialog (Shell parent, int style) {
  super (parent, checkStyle (parent, style));
  checkSubclass ();
}

origin: org.eclipse.platform/org.eclipse.swt.examples

Font oldFont = itemFont;
if (oldFont == null) oldFont = textNode1.getFont ();
fontDialog.setFontList(oldFont.getFontData());
FontData fontData = fontDialog.open ();
if (fontData == null) return;
oldFont = itemFont;
Font oldFont = cellFont;
if (oldFont == null) oldFont = textNode1.getFont (1);
fontDialog.setFontList(oldFont.getFontData());
FontData fontData = fontDialog.open ();
if (fontData == null) return;
oldFont = cellFont;
org.eclipse.swt.widgetsFontDialog

Javadoc

Instances of this class allow the user to select a font from all available fonts in the system. Styles: (none) Events: (none)

IMPORTANT: This class is not intended to be subclassed.

Most used methods

  • <init>
    Constructs a new instance of this class given its parent and a style value describing its behavior a
  • open
    Makes the dialog visible and brings it to the front of the display.
  • setFontList
    Sets the set of FontData objects describing the font to be selected by default in the dialog, or nul
  • checkStyle
  • checkSubclass
  • getRGB
    Returns an RGB describing the color that was selected in the dialog, or null if none is available.
  • setRGB
    Sets the RGB describing the color to be selected by default in the dialog, or null to let the platfo
  • setText
  • getFontList
    Returns a FontData set describing the font that was selected in the dialog, or null if none is avail
  • gtk_font_chooser_dialog_new
  • gtk_font_chooser_get_font
  • gtk_font_chooser_set_font
  • gtk_font_chooser_get_font,
  • gtk_font_chooser_set_font,
  • error,
  • setEffectsVisible,
  • ShowDialog,
  • addChangeListeners,
  • changeFont,
  • checkOperationMode,
  • convertHorizontalDLUsToPixels,
  • createButton

Popular in Java

  • Creating JSON documents from java classes using gson
  • requestLocationUpdates (LocationManager)
  • setContentView (Activity)
  • getSystemService (Context)
  • BufferedReader (java.io)
    Wraps an existing Reader and buffers the input. Expensive interaction with the underlying reader is
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • SortedMap (java.util)
    A map that has its keys ordered. The sorting is according to either the natural ordering of its keys
  • SSLHandshakeException (javax.net.ssl)
    The exception that is thrown when a handshake could not be completed successfully.
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Sublime Text for Python
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