Spec-Zone.ru › OpenJavaFX 8
javafx.scene.text

Enum FontWeight

java.lang.Object
  • java.lang.Enum<FontWeight>
    • javafx.scene.text.FontWeight

All Implemented Interfaces:

Serializable, Comparable<FontWeight>



public enum FontWeight
extends Enum<FontWeight>
Specifies different font weights which can be used when searching for a font on the system. The names correspond to pre-defined weights in the OS/2 table of the OpenType font specification. The CSS 3 specification references the same as a sequence of values.

Since:

JavaFX 2.0

  • Enum Constant Summary

    Enum Constants
    Enum Constant and Description
    BLACK
    represents Black font weight (900).
    BOLD
    represents Bold font weight (700).
    EXTRA_BOLD
    represents 'Extra Bold' font weight (800).
    EXTRA_LIGHT
    represents 'Extra Light' font weight (200).
    LIGHT
    represents Light font weight (300).
    MEDIUM
    represents Medium font weight (500).
    NORMAL
    represents Normal font weight (400).
    SEMI_BOLD
    represents 'Demi Bold' font weight (600).
    THIN
    represents Thin font weight (100).
  • Method Summary

    All MethodsStatic MethodsInstance MethodsConcrete Methods
    Modifier and Type Method and Description
    static FontWeight findByName(String name)
    Returns FontWeight by its name.
    static FontWeight findByWeight(int weight)
    Returns the closest FontWeight for a weight value as defined by the CSS and OpenType specifications.
    int getWeight()
    Return the visual weight (degree of blackness or thickness) specified by this FontWeight.
    static FontWeight valueOf(String name)
    Returns the enum constant of this type with the specified name.
    static FontWeight[] values()
    Returns an array containing the constants of this enum type, in the order they are declared.
    • Methods inherited from class java.lang.Enum

      clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
    • Methods inherited from class java.lang.Object

      getClass, notify, notifyAll, wait, wait, wait
  • Enum Constant Detail

    • THIN

      public static final FontWeight THIN
      represents Thin font weight (100).
    • EXTRA_LIGHT

      public static final FontWeight EXTRA_LIGHT
      represents 'Extra Light' font weight (200).
    • LIGHT

      public static final FontWeight LIGHT
      represents Light font weight (300).
    • NORMAL

      public static final FontWeight NORMAL
      represents Normal font weight (400).
    • MEDIUM

      public static final FontWeight MEDIUM
      represents Medium font weight (500).
    • SEMI_BOLD

      public static final FontWeight SEMI_BOLD
      represents 'Demi Bold' font weight (600).
    • BOLD

      public static final FontWeight BOLD
      represents Bold font weight (700).
    • EXTRA_BOLD

      public static final FontWeight EXTRA_BOLD
      represents 'Extra Bold' font weight (800).
    • BLACK

      public static final FontWeight BLACK
      represents Black font weight (900).
  • Method Detail

    • values

      public static FontWeight[] values()
      Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
      for (FontWeight c : FontWeight.values())
          System.out.println(c);

      Returns:

      an array containing the constants of this enum type, in the order they are declared

    • valueOf

      public static FontWeight valueOf(String name)
      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

      Parameters:

      name - the name of the enum constant to be returned.

      Returns:

      the enum constant with the specified name

      Throws:

      IllegalArgumentException - if this enum type has no constant with the specified name

    • getWeight

      public int getWeight()
      Return the visual weight (degree of blackness or thickness) specified by this FontWeight.

      Returns:

      weight

    • findByName

      public static FontWeight findByName(String name)
      Returns FontWeight by its name.

      Parameters:

      name - name of the FontWeight

    • findByWeight

      public static FontWeight findByWeight(int weight)
      Returns the closest FontWeight for a weight value as defined by the CSS and OpenType specifications. Where the specified value is equidistant between two FontWeight values, then the implementation may select either at its discretion. This lookup is without reference to a font, so this is purely a mapping to the set of FontWeight instances and does not mean that a font of that weight will be available.

      Returns:

      closest FontWeight

© 2008, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from JavaFX API Documentation.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Java, JavaFX and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API