Package
Class
Use
Tree
Deprecated
Index
All Classes
Help
Prev Class
Next Class
VAppearances – Release 4
Class org.violetlib.vappearances.VAppearances
Inherited members: ShowHide
Deprecated: ShowHide
org.violetlib.vappearances

Class VAppearances

  • Object
    • VAppearances
  • public class VAppearances extends Object
    This class keeps track of macOS appearances and their attributes. The attributes of an appearance of interest to Java applications are the values of system colors.

    On macOS 10.14, there are four standard appearances. Previously, there was just one. The standard appearances are identified using standard names.

    The values of system colors depends upon the selected appearance. Some system colors also depend on the selected accent color, the selected highlight color, and whether the increase contrast accessibility option is enabled. This class takes a snapshot of the system colors and makes the colors available in a VAppearance object. When the accent color, highlight color, or increase contrast option is changed, a new snapshot of the system colors is created and a new VAppearance object is created containing the new colors.

    AppKit applications are notified of changes to system colors in two ways. Some changes use a system color change notification. Others invoke the viewDidChangeEffectiveAppearance method on NSView instances. To ensure that this class has the current data, the implementation of this NSView method should provide the NSAppearance object to the native function VAppearances_updateAppearance(NSAppearance *).

    AppKit uses instances of NSAppearance in a tricky way. At any one time, there is a current NSAppearance object for each of the standard appearance names. However, at various times, new instances are created that replace the previous instances. This trickery is not important to Java, as Java identifies appearances by their standard names. The current NSAppearance is determined as needed using the name.

    • Nested Classes 
      Modifier and Type Class and Description
      Ordinary member indicator AppearanceChangeEvent Reveal DetailHide Detail
      static class AppearanceChangeEvent
      A change event that identifies the appearance that has changed.
      static class AppearanceChangeEvent
      A change event that identifies the appearance that has changed.
      See Also:
      Serialized Form
    • Fields 
      Modifier and Type Field and Description
      Ordinary member indicator aquaAppearance Reveal DetailHide Detail
      static String aquaAppearance
      The name of the light Aqua appearance
      public static final String aquaAppearance
      The name of the light Aqua appearance
      See Also:
      Constant Field Values
      Ordinary member indicator darkAquaAppearance Reveal DetailHide Detail
      static String darkAquaAppearance
      The name of the dark Aqua appearance
      public static final String darkAquaAppearance
      The name of the dark Aqua appearance
      See Also:
      Constant Field Values
      Ordinary member indicator vibrantDarkAppearance Reveal DetailHide Detail
      static String vibrantDarkAppearance
      The name of the vibrant dark appearance
      public static final String vibrantDarkAppearance
      The name of the vibrant dark appearance
      See Also:
      Constant Field Values
      Ordinary member indicator vibrantLightAppearance Reveal DetailHide Detail
      static String vibrantLightAppearance
      The name of the vibrant light appearance
      public static final String vibrantLightAppearance
      The name of the vibrant light appearance
      See Also:
      Constant Field Values
    • Static Methods 
      Modifier and Type Static Method and Description
      Ordinary member indicator addChangeListener Reveal DetailHide Detail
      static void addChangeListener(ChangeListener listener)
      Register a change listener to be called when an appearance with a new name becomes known or a previously known appearance is replaced with an appearance with the same name but different attributes (system color values).
      public static void addChangeListener(ChangeListener listener)
      Register a change listener to be called when an appearance with a new name becomes known or a previously known appearance is replaced with an appearance with the same name but different attributes (system color values). All invocations of the listener are performed on the AWT event dispatching thread. The parameter, an instance of VAppearances.AppearanceChangeEvent, provides the name of the new or changed appearance.
      Parameters:
      listener - The listener to be registered.
      Ordinary member indicator addEffectiveAppearanceChangeListener Reveal DetailHide Detail
      static void addEffectiveAppearanceChangeListener(ChangeListener listener)
      Register a change listener to be called when the application effective appearance is changed, for example, from light to dark or vice versa.
      public static void addEffectiveAppearanceChangeListener(ChangeListener listener)
      Register a change listener to be called when the application effective appearance is changed, for example, from light to dark or vice versa. The concept of an application effective appearance was introduced in macOS 10.14.

      This listener may be called when the user specified accent color or highlight color changes.

      All invocations of the listener are performed on the AWT event dispatching thread.

      Parameters:
      listener - The listener to be registered.
      Ordinary member indicator getAppearance Reveal DetailHide Detail
      static VAppearance getAppearance(String appearanceName)
      Return the current attributes of the specified appearance.
      public static VAppearance getAppearance(String appearanceName) throws IOException
      Return the current attributes of the specified appearance.
      Parameters:
      appearanceName - The appearance name.
      Returns:
      an object containing the currently known attributes.
      Throws:
      IOException - if the appearance is not defined or not available, or if the data could not be obtained.
      Ordinary member indicator getApplicationEffectiveAppearance Reveal DetailHide Detail
      static VAppearance getApplicationEffectiveAppearance()
      Return the current effective appearance of the application.
      public static VAppearance getApplicationEffectiveAppearance() throws IOException
      Return the current effective appearance of the application.
      Returns:
      an object containing the currently known attributes.
      Throws:
      IOException - if the appearance is not defined or not available, or if the data could not be obtained.
      Ordinary member indicator removeChangeListener Reveal DetailHide Detail
      static void removeChangeListener(ChangeListener listener)
      Unregister a previously registered change listener.
      public static void removeChangeListener(ChangeListener listener)
      Unregister a previously registered change listener.
      Parameters:
      listener - The listener to be unregistered.
      Ordinary member indicator removeEffectiveAppearanceChangeListener Reveal DetailHide Detail
      static void removeEffectiveAppearanceChangeListener(ChangeListener listener)
      Unregister a previously registered change listener.
      public static void removeEffectiveAppearanceChangeListener(ChangeListener listener)
      Unregister a previously registered change listener.
      Parameters:
      listener - The listener to be unregistered.
      • Methods inherited from class Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait