Package swingtree

Enum Class SwingTreeInitConfig.CacheMode

java.lang.Object
java.lang.Enum<SwingTreeInitConfig.CacheMode>
swingtree.SwingTreeInitConfig.CacheMode
All Implemented Interfaces:
Serializable, Comparable<SwingTreeInitConfig.CacheMode>, Constable
Enclosing class:
SwingTreeInitConfig

public static enum SwingTreeInitConfig.CacheMode extends Enum<SwingTreeInitConfig.CacheMode>
Defines how aggressively SwingTree trades memory for CPU time across all of its internal rendering caches (style layer images, rasterised text, noise tiles, shadow gradients and text layouts). Higher modes keep more rendered results in memory so that subsequent repaints can blit them instead of re-rendering, which is a large saving for complex or text-heavy UIs under load (e.g. while a window is being resized) — at the cost of more heap and video memory. The chosen mode is combined with the amount of system RAM to derive a concrete memory budget, so the same mode scales sensibly across machines.

This can also be selected through the system property "swingtree.cacheMode" (the enum constant name, case-insensitive), and changed at runtime through SwingTree.setCacheMode(CacheMode).

See Also:
  • Enum Constant Details

    • DISABLED

      public static final SwingTreeInitConfig.CacheMode DISABLED
      Caching is turned off entirely: every cache is emptied and bypassed, regardless of how much RAM the machine has. Painting always re-renders from scratch — the lowest memory footprint, the highest CPU cost.
    • CONSERVATIVE

      public static final SwingTreeInitConfig.CacheMode CONSERVATIVE
      A small, cautious memory footprint. Only the cheapest and most reused rendering results are kept. Good for memory-constrained environments.
    • BALANCED

      public static final SwingTreeInitConfig.CacheMode BALANCED
      The default: a balanced trade-off between memory and CPU that reproduces SwingTree's historical, RAM-scaled caching behaviour.
    • GENEROUS

      public static final SwingTreeInitConfig.CacheMode GENEROUS
      Leans towards caching more: keeps noticeably more rendered results in memory to further reduce repaint cost on machines that can spare the RAM.
    • AGGRESSIVE

      public static final SwingTreeInitConfig.CacheMode AGGRESSIVE
      Caches as much as the memory budget allows, trading the most memory for the least CPU time. Intended for powerful machines running heavy, animated or frequently-repainted UIs.
  • Method Details

    • values

      public static SwingTreeInitConfig.CacheMode[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static SwingTreeInitConfig.CacheMode valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified name
      NullPointerException - if the argument is null