Class FlatDefaultsAddon

  • Direct Known Subclasses:
    FlatSwingXDefaultsAddon

    public abstract class FlatDefaultsAddon
    extends java.lang.Object
    Addon for FlatLaf UI defaults. Allows loading of additional .properties files from addon JARs. ServiceLoader is used to load extensions of this class from addon JARs.

    If you extend this class in an addon JAR, you also have to add a text file named META-INF/services/com.formdev.flatlaf.FlatDefaultsAddon to the addon JAR. The file must contain a single line with the class name.

    See 'flatlaf-swingx' addon for an example

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void afterDefaultsLoading​(javax.swing.LookAndFeel laf, javax.swing.UIDefaults defaults)
      Allows modifying UI defaults after loading UI defaults.
      java.io.InputStream getDefaults​(java.lang.Class<?> lafClass)
      Finds an addon .properties file for the given LaF class and returns it as input stream.
      int getPriority()
      Returns the priority used to sort addon loading.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FlatDefaultsAddon

        public FlatDefaultsAddon()
    • Method Detail

      • getDefaults

        public java.io.InputStream getDefaults​(java.lang.Class<?> lafClass)
        Finds an addon .properties file for the given LaF class and returns it as input stream. Or null if not found.

        This default implementation finds addon .properties file for the given LaF class in the same package as the subclass.

        Override this method to load addon .properties files from other locations.

      • afterDefaultsLoading

        public void afterDefaultsLoading​(javax.swing.LookAndFeel laf,
                                         javax.swing.UIDefaults defaults)
        Allows modifying UI defaults after loading UI defaults. The default implementation does nothing.
      • getPriority

        public int getPriority()
        Returns the priority used to sort addon loading. The order is only important if you want to overwrite UI defaults of other addons. Lower numbers mean higher priority. Returns 10000 by default.