Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-5029074

RFE: constants (final static fields) for logical font names

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 6
    • 6
    • client-libs
    • 2d
    • mustang
    • x86
    • windows_2000

      Name: rmT116609 Date: 04/08/2004


      A DESCRIPTION OF THE REQUEST :
      java.awt.Font class doc says "Logical fonts are the five font families defined by the Java platform which must be supported by any Java runtime environment: Serif, SansSerif, Monospaced, Dialog, and DialogInput.". However, java.awt.Font does not have constants fields for these names.


      JUSTIFICATION :
      The compiler cannot check the spelling of "monospace" in Font.decode("monospace") and a human eye check of the UI is required. For example, monospaced is often mispelled (monospace, monospacing, etc.)

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Would like to be able to use

      Font.decode(Font.MONOSPACED)

      so the compiler would produce an error if this was mispelled as Font.MONOSPACE
      ACTUAL -
      The compile does not complain about

      Font.decode("monospace")

      so the error is not caught until a human eye notices the problem.

      CUSTOMER SUBMITTED WORKAROUND :
      Create own MONOSPACED constant in every program that needs it..
      (Incident Review ID: 246860)
      ======================================================================

            prr Philip Race
            rmandalasunw Ranjith Mandala (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: