if (usePreviousResultButton.getSelection()) { dialog.setFontList (fontDialogFontListResult); dialog.setRGB(fontDialogColorResult);
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(); } }
dialog.setRGB(rgb);
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); } }
private void selectFont () { try { FontDialog dlg = new FontDialog(getShell()); 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(getDisplay(), fontData); edExample.setFont(opt.font); tmp.dispose(); // And the new new color opt.foreground.dispose(); opt.foreground = new Color(getDisplay(), dlg.getRGB()); edExample.setForeground(opt.foreground); } catch ( Throwable e ) { Dialogs.showError(getShell(), e.getLocalizedMessage(), null); } }