TreasureMap 是一个 Java 类库,提供了 JSR-296 (Swing Application Framework) 的 ResourceMap 实现。
示例代码:
package com.foobar;
import java.util.Locale;
import com.dteoh.treasuremap.ResourceMaps;
import org.jdesktop.application.ResourceMap;
class Foo {
// Create a ResourceMap for Foo only
ResourceMap rMap = new ResourceMaps(Foo.class).build();
// Create a ResourceMap for Bar with Foo’s map as the parent
ResourceMap rMap2 = new ResourceMaps(Bar.class).withParent(rMap).build();
// Create a ResourceMap for Foo and Bar all in one
ResourceMap rMapFB = new ResourceMaps(Foo.class).and(Bar.class).build();
// Create a ResourceMap for RainbowA and RainbowB with a parent map
ResourceMap rMapWhoa = new ResourceMaps(RainbowA.class).and(RainbowB.class).withParent(rMapFB).build();
// Create a ResourceMap for the “ABC” Locale
ResourceMap rMap = new ResourceMaps(Foo.class, new Locale(“ABC”)).build();
}