Showing posts with label java. Show all posts
Showing posts with label java. Show all posts

Thursday, February 12, 2009

StringToMap

First version of StringToMap has been just released.

This small utility class/library can convert string with key:value items separated by separator character to Java Map. This is helpful when dealing with resource bundles for Swing/SWT UI, as you can put more values to one resource bundle property.

E.g.:

gui.action.file.opendb = lb:Open database...|mn:O|ic:disk.png|tp:Open existing database from specific directory.


Will result in following Map (keys and values are separated by ':'):


lb:Open database...,
mn:O|ic:disk.png,
tp:Open existing database from specific directory.


Now it is easy to get value for label with get("lb"), mnemonic get("mn") or tooltip get("tp").