FlatLaf: use larger initial capacity for UI defaults table to avoid resizing hash table and to save some memory

This commit is contained in:
Karl Tauber
2021-08-13 00:13:54 +02:00
parent 751919ec5a
commit 7bc9be686f

View File

@@ -354,7 +354,14 @@ public abstract class FlatLaf
@Override @Override
public UIDefaults getDefaults() { public UIDefaults getDefaults() {
UIDefaults defaults = super.getDefaults(); // use larger initial capacity to avoid resizing UI defaults hash table
// (from 610 to 1221 to 2443 entries) and to save some memory
UIDefaults defaults = new UIDefaults( 1500, 0.75f );
// initialize basic defaults (see super.getDefaults())
initClassDefaults( defaults );
initSystemColorDefaults( defaults );
initComponentDefaults( defaults );
// add flag that indicates whether the LaF is light or dark // add flag that indicates whether the LaF is light or dark
// (can be queried without using FlatLaf API) // (can be queried without using FlatLaf API)