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


Java Font.getFontName方法代码示例

本文整理汇总了Java中java.awt.Font.getFontName方法的典型用法代码示例。如果您正苦于以下问题:Java Font.getFontName方法的具体用法?Java Font.getFontName怎么用?Java Font.getFontName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.Font的用法示例。


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

示例1: instantiate

import java.awt.Font; //导入方法依赖的package包/类
@Override
protected Expression instantiate(Object oldInstance, Encoder enc) {
    Font font = (Font) oldInstance;
    return new Expression(oldInstance, oldInstance.getClass(),
            BeansUtils.NEW, new Object[] { font.getFontName(),
                    font.getStyle(), font.getSize() });
}
 
开发者ID:yippeesoft,项目名称:NotifyTools,代码行数:8,代码来源:AwtFontPersistenceDelegate.java

示例2: setValue

import java.awt.Font; //导入方法依赖的package包/类
@Override
public void setValue(Object value) {
    if (value == null) {
        setText("");
        return;
    }
    
    Font font = (Font) value;
    setFont(font);
    
    String tooltip = font.getFontName() + ", " + font.getSize();
    
    setToolTipText(tooltip);
}
 
开发者ID:takun2s,项目名称:smile_1.5.0_java7,代码行数:15,代码来源:FontCellRenderer.java

示例3: sizeLabelFont

import java.awt.Font; //导入方法依赖的package包/类
private void sizeLabelFont(GLabel label, double width, double height) {
	int size, style;
	String name;
	Font f = label.getFont();
	name = f.getFontName();
	style = f.getStyle();
	size = f.getSize();
	while(label.getWidth() < width && label.getHeight() < height) {
		f = label.getFont();
		size = f.getSize();
		label.setFont(new Font(name, style, size+1));
	}
	label.setFont(new Font(name, style, size-1));
}
 
开发者ID:cookerlyk,项目名称:missile-defense,代码行数:15,代码来源:GButton.java

示例4: changeTickFontSize

import java.awt.Font; //导入方法依赖的package包/类
/**
 * Increases or decreases the tick font size.
 *
 * @param delta  the change in size.
 */
public void changeTickFontSize(int delta) {
    Font f = getTickLabelFont();
    String fName = f.getFontName();
    Font newFont = new Font(fName, f.getStyle(), (f.getSize() + delta));
    setTickLabelFont(newFont);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:12,代码来源:JThermometer.java

示例5: setTickFontStyle

import java.awt.Font; //导入方法依赖的package包/类
/**
 * Sets the tick font style.
 *
 * @param style  the style.
 */
public void setTickFontStyle(int style) {
    Font f = getTickLabelFont();
    String fName = f.getFontName();
    Font newFont = new Font(fName, style, f.getSize());
    setTickLabelFont(newFont);
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:12,代码来源:JThermometer.java

示例6: main

import java.awt.Font; //导入方法依赖的package包/类
public static void main(String [] args) {
   System.setProperty("sun.java2d.debugfonts", "true");
   Font font = new Font("dialog", Font.PLAIN, 14);
   System.out.println(font);
   String s1 = font.getFamily();
   String s2 = font.getFontName();
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:8,代码来源:DebugFonts.java

示例7: main

import java.awt.Font; //导入方法依赖的package包/类
public static void main(String[] args) {

        String os = System.getProperty("os.name", "");
        if (!os.toLowerCase().startsWith("win")) {
            return;
        }
        System.setProperty("user.language", "de");
        System.setProperty("user.country", "AT");
        Locale de_atLocale = new Locale("de", "AT");
        Locale.setDefault(de_atLocale);

        String family = "Verdana";
        Font font = new Font(family, Font.BOLD, 12);
        if (!font.getFamily(Locale.ENGLISH).equals(family)) {
            System.out.println(family + " not found - skipping test.");
            return;
        }

        String atFontName = font.getFontName();
        Locale deGELocale = new Locale("de", "GE");
        String deFontName = font.getFontName(deGELocale);
        System.out.println("Austrian font name: " + atFontName);
        System.out.println("German font name: " + deFontName);

        String deLangFullName = "Verdana Fett";
        // We expect "Fett" for "Bold" when the language is German.
        // This font does have that so these should both be equal and
        // say "Verdana Fett"
        if (!deFontName.equals(atFontName)) {
            throw new RuntimeException("Font names differ " +
                                       deFontName + " " + atFontName);
        }
        if (!deLangFullName.equals(deFontName)) {
            throw new RuntimeException("Font name is not " + deLangFullName +
                                       " instead got " + deFontName);
        }
    }
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:38,代码来源:TrueTypeFontLocaleNameTest.java

示例8: PrintInformation

import java.awt.Font; //导入方法依赖的package包/类
public static String PrintInformation(Font f){
	return f.getSize() + ";" + f.getFontName() + ";";
}
 
开发者ID:PhentixDevs,项目名称:PhySIX,代码行数:4,代码来源:FontUtil.java

示例9: getFontName

import java.awt.Font; //导入方法依赖的package包/类
public static String getFontName(Font f){
	return f.getFontName();
}
 
开发者ID:PhentixDevs,项目名称:PhySIX,代码行数:4,代码来源:FontUtil.java

示例10: DoPaint

import java.awt.Font; //导入方法依赖的package包/类
@Override
    public void DoPaint(Graphics2D g) {
        super.DoPaint(g);
        Rectangle rec = getArea();
        Color bkpc = g.getColor();

        g.setColor(getBorderColor());

        g.drawRect(rec.x, rec.y, rec.width, rec.height);

        Rectangle bkp = g.getClipBounds();
        g.clipRect(rec.x, rec.y, rec.width, rec.height);

        Font fn = getFont();
        Font font = new Font(fn.getFontName(), fn.getStyle(), fn.getSize() - 2);

        fn = g.getFont();
        g.setFont(font);

        altura = g.getFontMetrics().getHeight() + g.getFontMetrics().getDescent();
        alturaTitulo = altura + altura / 2;

        Composite originalComposite = g.getComposite();
        float alfa = 0.8f;
        g.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alfa));

        if (getTipo() == TipoLegenda.tpObjetos) {
            altura = Math.max(32, altura);
        }

        int posi = altura + alturaTitulo + rec.y;
        final int lft = rec.x + 2;

        for (ItemDeLegenda it : getItens()) {

            if (it.isSelecionada()) {
                g.setColor(isDisablePainted()? disabledColor : new Color(204, 204, 255, 50));
                g.fillRect(lft, posi - altura - 2, getWidth(), altura + 4);
            }
            g.setColor(isDisablePainted()? disabledColor : it.cor);
            int moveleft;
            switch (getTipo()) {
                case tpLinhas:
                    moveleft = 3 * altura;
                    g.fillRoundRect(lft, posi - (altura / 2) - 2, moveleft - 2, 4, 2, 2);
                    g.setColor(bkpc);
                    g.drawString(it.texto, lft + moveleft, posi - 6);
                    break;
                case tpObjetos:
                    ImageIcon img = Editor.fromControler().getImagemNormal(getMaster().getCassesDoDiagrama()[it.getTag()].getSimpleName());
                    g.drawImage(util.TratadorDeImagens.ReColorBlackImg(img, it.getCor()), lft, posi - altura, null);
                    moveleft = altura + 2;
                    g.drawString(it.texto, lft + moveleft, posi - altura / 2 + 6);
                    break;
                default:
                    moveleft = altura;
                    g.fillRect(lft, posi - altura, altura - 4, altura - 4);
                    g.setColor(bkpc);
                    g.drawRect(lft, posi - altura, altura - 4, altura - 4);
                    g.drawString(it.texto, lft + moveleft, posi - 6);
            }
            it.Area = new Point(posi - altura - 2, altura + 4);
            posi += altura + 4;
        }

        g.setComposite(originalComposite);

//        g.setColor(Color.LIGHT_GRAY);
//        g.drawLine(lft - 1, posi - altura - 2, getLeft() + getWidth() - 1, posi - altura - 2);
        g.setClip(bkp);
        g.setFont(fn);
    }
 
开发者ID:chcandido,项目名称:brModelo,代码行数:73,代码来源:Legenda.java


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