Class FlatDefaultsAddon


  • public abstract class FlatDefaultsAddon
    extends 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

    • Constructor Detail

      • FlatDefaultsAddon

        public FlatDefaultsAddon()
    • Method Detail

      • getDefaults

        public InputStream getDefaults​(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​(LookAndFeel laf,
                                         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.