Java Font from System getDefaultMapXMLCreatorFontName()

Here you can find the source of getDefaultMapXMLCreatorFontName()

Description

Tries to find preferredMapXMLCreatorFontName font or takes the first in the list of available fonts.

License

Open Source License

Return

default font name for XML Creator

Declaration

public static String getDefaultMapXMLCreatorFontName() 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.awt.GraphicsEnvironment;

public class Main {
    final public static String preferredMapXMLCreatorFontName = "Tahoma";

    /**//from w  w w  .  j a  v  a  2  s  .c om
     * Tries to find preferredMapXMLCreatorFontName font or takes the first in the list of available fonts.
     *
     * @return default font name for XML Creator
     */
    public static String getDefaultMapXMLCreatorFontName() {
        final String[] availableFontFamilyNames = GraphicsEnvironment.getLocalGraphicsEnvironment()
                .getAvailableFontFamilyNames();
        for (final String fontName : availableFontFamilyNames) {
            if (fontName.equals(preferredMapXMLCreatorFontName)) {
                return fontName;
            }
        }
        return availableFontFamilyNames[0];
    }
}

Related

  1. getDefaultFont()
  2. getDefaultFont()
  3. getDefaultFont()
  4. getDefaultFontRenderContext()
  5. getDefaultFrc()
  6. getDefaultMonoFontSize()
  7. getDefaultSansSerifFont()
  8. getSystemFontNames()
  9. getSystemFonts()