当前位置: 首页>>代码示例>>Java>>正文


Java FontDialog类代码示例

本文整理汇总了Java中org.eclipse.swt.widgets.FontDialog的典型用法代码示例。如果您正苦于以下问题:Java FontDialog类的具体用法?Java FontDialog怎么用?Java FontDialog使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FontDialog类属于org.eclipse.swt.widgets包,在下文中一共展示了FontDialog类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addSelectionListeneronToFontButton

import org.eclipse.swt.widgets.FontDialog; //导入依赖的package包/类
private void addSelectionListeneronToFontButton(Button fontButton, TableEditor fontEditor) {
	fontButton.addSelectionListener(new SelectionAdapter() {

		@Override
		public void widgetSelected(SelectionEvent e) {
			String fontdata = "";
			dialog = new FontDialog(Display.getCurrent().getActiveShell(), SWT.NONE);
			dialog.setText("Select Font");
			String string = formatMap.get(excelFormats[4]);
			fontdata = checkDefaultValue(fontEditor, fontdata, string);
			RGB checkDefaultColor = checkDefaultColor(fontdata, string);
			dialog.setRGB(checkDefaultColor);
			FontData defaultFont = new FontData(fontdata);
			dialog.setFontData(defaultFont);
			FontData newFont = dialog.open();
			RGB rgb = dialog.getRGB();
			String convertRGBToHEX = convertRGBToHEX(rgb);
			if (newFont != null) {
				fontEditor.getItem().setText(1, newFont.toString() + "|" + convertRGBToHEX);

			}
		}

	});
}
 
开发者ID:capitalone,项目名称:Hydrograph,代码行数:26,代码来源:HeaderAndDataFormattingDialog.java

示例2: getFontChooser

import org.eclipse.swt.widgets.FontDialog; //导入依赖的package包/类
private FontData getFontChooser(final Composite parent,String title,FontData fontData){
	final FontData selection = new FontData(fontData.getName(),fontData.getHeight(),fontData.getStyle());
	
	Label label = new Label(parent, SWT.NULL);
	label.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, true));
	label.setText(title);
	
	Button button = new Button(parent, SWT.PUSH);
	button.setLayoutData(getAlignmentData(MINIMUM_CONTROL_WIDTH,SWT.FILL));
	button.setText(TuxGuitar.getProperty("choose"));
	button.addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent arg0) {
			Font font = new Font(parent.getDisplay(),selection);
			FontDialog fontDialog = new FontDialog(parent.getShell());
			fontDialog.setFontList(font.getFontData());
			FontData fd = fontDialog.open();
			if(fd != null){
				selection.setName( fd.getName() );
				selection.setHeight( fd.getHeight() );
				selection.setStyle( fd.getStyle() );
			}
			font.dispose();
		}
	});
	return selection;
}
 
开发者ID:theokyr,项目名称:TuxGuitar-1.3.1-fork,代码行数:27,代码来源:TGMatrixConfig.java

示例3: addFontButtonListeners

import org.eclipse.swt.widgets.FontDialog; //导入依赖的package包/类
private void addFontButtonListeners(final Button button, final FontData fontData){
	button.addSelectionListener(new SelectionAdapter() {
		public void widgetSelected(SelectionEvent arg0) {
			if(StylesOption.this.initialized){
				Font font = new Font(getDisplay(),fontData);
				FontData[] fontDataList = font.getFontData();
				font.dispose();
				FontDialog fontDialog = new FontDialog(getShell());
				fontDialog.setFontList(fontDataList);
				FontData result = fontDialog.open();
				if(result != null){
					loadFontData(result, fontData,button);
				}
			}
		}
	});
}
 
开发者ID:theokyr,项目名称:TuxGuitar-1.3.1-fork,代码行数:18,代码来源:StylesOption.java

示例4: onChangeFont

import org.eclipse.swt.widgets.FontDialog; //导入依赖的package包/类
private void onChangeFont() {

		FontData selectedFont;

		final FontDialog fontDialog = new FontDialog(_btnChangeFont.getShell());

		fontDialog.setFontList(_selectedFontData);
		fontDialog.setEffectsVisible(false);

		fireOpenEvent(true);
		{
			selectedFont = fontDialog.open();
		}
		fireOpenEvent(false);

		if (selectedFont != null) {
			fireFontChanged(selectedFont);
		}
	}
 
开发者ID:wolfgang-ch,项目名称:mytourbook,代码行数:20,代码来源:SimpleFontEditor.java

示例5: FontPicker

import org.eclipse.swt.widgets.FontDialog; //导入依赖的package包/类
public FontPicker(final Composite parent, Font originalFont) {
    super(parent, SWT.NONE);
    if (originalFont == null) throw new IllegalArgumentException("null");
    
    update(originalFont.getFontData()[0]);
    
    addSelectionListener(
            new SelectionAdapter() {
                @Override
                public void widgetSelected(SelectionEvent e) {
                	FontDialog dialog = new FontDialog(new Shell(Display.getDefault(), SWT.SHELL_TRIM));
                    dialog.setFontList(fontData);
                    FontData selected = dialog.open();
                    if (selected != null) {                            
                        update(selected);
                        pack(true);
                    }
                }
            });
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:21,代码来源:FontPicker.java

示例6: openFontDialog

import org.eclipse.swt.widgets.FontDialog; //导入依赖的package包/类
/**
 * 
 * void
 */
private void openFontDialog() {
    FontDialog dialog = new FontDialog(UiCorePlugin.getShell(), SWT.NONE);
    if (fontListOfDialog[0] != null) {
        if (fontListOfDialog != fontList) {
            dialog.setFontList(fontListOfDialog);
        } else {
            dialog.setFontList(fontList);
        }
    } else {
        dialog.setFontList(fontList);
    }
    fontListOfDialog[0] = dialog.open();
    defaultFontPreviewLabel.setText(getFormatedFontString(fontListOfDialog));
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:19,代码来源:AppearancePreferencePage.java

示例7: main

import org.eclipse.swt.widgets.FontDialog; //导入依赖的package包/类
/**
 * @param args
 */
public static void main(String[] args)
{
	Display display = new Display();
	Shell shell = new Shell(display);
	//		displayAllLoadedFonts(shell);
	loadFont(shell, "amigaforeverpro2.ttf", 8);
	loadFont(shell, "E:/AAEW/dev/ws_bts_v2/org.bbaw.bts.ui.font.egyFont/font/FreeSerif.ttf", 8);
	displayAllLoadedFonts(shell);

	FontDialog dialog = new FontDialog(shell);
	dialog.open();
	Font f = new Font(display, dialog.getFontList());
}
 
开发者ID:cplutte,项目名称:bts,代码行数:17,代码来源:Test.java

示例8: widgetSelected

import org.eclipse.swt.widgets.FontDialog; //导入依赖的package包/类
@Override
public void widgetSelected(SelectionEvent ignored)
{
	FontDialog fontDialog = new FontDialog(parentShell, SWT.OPEN);
	fontDialog.setFontList(bzStyledText.getBrailleFont().getFontData());
	FontData fontData = fontDialog.open();
	if(fontData == null)
		return;
	bzStyledText.setBrailleFont(new Font(parentShell.getDisplay(), fontData));
}
 
开发者ID:MikeGray-APH,项目名称:BrailleZephyr,代码行数:11,代码来源:BZMenu.java

示例9: activate

import org.eclipse.swt.widgets.FontDialog; //导入依赖的package包/类
/** Opens the color dialog. */
@Override
public void activate()
{
    final FontDialog dialog = new FontDialog(shell);
    if (value != null)
        dialog.setFontList(new FontData[] { value });
    value = dialog.open();
    if (value != null)
        fireApplyEditorValue();
}
 
开发者ID:kasemir,项目名称:org.csstudio.display.builder,代码行数:12,代码来源:FontCellEditor.java

示例10: widgetSelected

import org.eclipse.swt.widgets.FontDialog; //导入依赖的package包/类
@Override
public void widgetSelected(final SelectionEvent e) {
	final FontDialog dialog = new FontDialog(WorkbenchHelper.getShell());
	dialog.setEffectsVisible(false);
	FontData data = toFontData(currentValue);
	dialog.setFontList(new FontData[] { data });
	data = dialog.open();
	if (data != null) {
		modifyAndDisplayValue(toGamaFont(data));
	}

}
 
开发者ID:gama-platform,项目名称:gama,代码行数:13,代码来源:FontEditor.java

示例11: createFontArea

import org.eclipse.swt.widgets.FontDialog; //导入依赖的package包/类
private void createFontArea(Composite composite)
{
	Composite themesComp = new Composite(composite, SWT.NONE);
	themesComp.setLayout(new GridLayout(3, false));
	themesComp.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

	Label label = new Label(themesComp, SWT.NONE);
	label.setText(Messages.ThemePreferencePage_FontNameLabel);

	fFont = JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT);
	fFontText = new Text(themesComp, SWT.BORDER | SWT.SINGLE | SWT.READ_ONLY);
	fFontText.setText(toString(fFont));
	fFontText.setFont(fFont);
	fFontText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

	Button selectFontButton = new Button(themesComp, SWT.PUSH);
	selectFontButton.setText(Messages.ThemePreferencePage_SelectFontButtonLabel);
	selectFontButton.addSelectionListener(new SelectionAdapter()
	{
		@Override
		public void widgetSelected(SelectionEvent e)
		{
			final FontDialog fontDialog = new FontDialog(getShell());
			fontDialog.setFontList(fFont.getFontData());
			final FontData data = fontDialog.open();
			if (data != null)
			{
				setFont(new Font(fFont.getDevice(), fontDialog.getFontList()));
			}
		}
	});
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:33,代码来源:ThemePreferencePage.java

示例12: selectAndSaveFont

import org.eclipse.swt.widgets.FontDialog; //导入依赖的package包/类
/**
 * shows font dialog and save user choice to preferences
 * 
 * @param isTitle true if must set font for title, false for text
 */
private void selectAndSaveFont (final boolean isTitle) {
	display.asyncExec(new Runnable() {
		@Override
		public void run() {
			FontDialog fd = new FontDialog(shell);
	        fd.setText(DesktopDrinViewerConstants.i18nMessages.getString("selectfont"));
	        fd.setRGB(new RGB(0, 0, 0));
	        fd.setFontList(DrinViewer.getNotificationFont(display, isTitle));
	        if (fd.open() != null) {
	        	// save font
	    		String namePref  = (isTitle) ? DesktopDrinViewerConstants.PREFS_TITLEFONTNAME : 
					   DesktopDrinViewerConstants.PREFS_TEXTFONTNAME;
	    		String sizePref  = (isTitle) ? DesktopDrinViewerConstants.PREFS_TITLEFONTSIZE :
					   DesktopDrinViewerConstants.PREFS_TEXTFONTSIZE;
	    		String stylePref = (isTitle) ? DesktopDrinViewerConstants.PREFS_TITLEFONTSTYLE :
					   DesktopDrinViewerConstants.PREFS_TEXTFONTSTYLE;
	    		
	    		prefs.put(namePref, fd.getFontList()[0].getName());
	    		prefs.putInt(sizePref, fd.getFontList()[0].getHeight());
	    		prefs.putInt(stylePref, fd.getFontList()[0].getStyle());
	    		try {
					prefs.flush();
				} catch (BackingStoreException e) {
					e.printStackTrace();
				}
	        }
		}
	});		
}
 
开发者ID:HobieCat,项目名称:drinviewer,代码行数:35,代码来源:DrinViewer.java

示例13: handleChangeFontPressed

import org.eclipse.swt.widgets.FontDialog; //导入依赖的package包/类
/**
 * This method is invoked when the user selects the "Change" font button. It
 * opens the FontDialog to allow the user to change the font.
 */
protected void handleChangeFontPressed() {
	FontDialog dialog = new FontDialog(getShell());
	FontData data = prefs.getFontData();
	dialog.setFontList(new FontData[] { data });
	data = dialog.open();
	if (data != null) {
		prefs.setFontData(data);
	}
	updateFontName();
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:15,代码来源:PaletteSettingsDialog.java

示例14: construct

import org.eclipse.swt.widgets.FontDialog; //导入依赖的package包/类
public Control construct(Composite parent) {
	final Composite composite = new Composite(parent, SWT.NONE);
	GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL)
			.grab(true, true).applyTo(composite);
	GridLayoutFactory.swtDefaults().numColumns(2).applyTo(composite);
	
	final Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
	
	final Text t  = new Text(composite, SWT.BORDER | SWT.NONE);
    t.setText("Example text");
	t.setBounds(80, 2, 300, 20);
    		
    Button button = new Button(composite, SWT.PUSH);
    button.setText("Change Font");
    button.setBounds(2, 30, 100, 30);
    
    button.addSelectionListener(new SelectionAdapter() {
      @SuppressWarnings("deprecation")
	public void widgetSelected(SelectionEvent e) {
        FontDialog fd = new FontDialog(shell, SWT.NONE);
        fd.setText("Select Font");
        fd.setRGB(new RGB(0, 0, 255));
        FontData defaultFont = new FontData("Courier", 10, SWT.BOLD);
        fd.setFontData(defaultFont);
        FontData newFont = fd.open();
        if (newFont == null)
          return;
        t.setFont(new Font(shell.getDisplay(), newFont));
        t.setForeground(new Color(shell.getDisplay(), fd.getRGB()));
 
      }
    });
   
	return null;
	
}
 
开发者ID:xored,项目名称:q7.quality.mockups,代码行数:37,代码来源:FontDialogTest.java

示例15: setFont

import org.eclipse.swt.widgets.FontDialog; //导入依赖的package包/类
/**
 * Sets the font related data to be applied to the text in page 2.
 */
void setFont() {
	FontDialog fontDialog = new FontDialog(getSite().getShell());
	fontDialog.setFontList(text.getFont().getFontData());
	FontData fontData = fontDialog.open();
	if (fontData != null) {
		if (font != null)
			font.dispose();
		font = new Font(text.getDisplay(), fontData);
		text.setFont(font);
	}
}
 
开发者ID:patternbox,项目名称:patternbox-eclipse,代码行数:15,代码来源:MultiPageEditor.java


注:本文中的org.eclipse.swt.widgets.FontDialog类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。