Bidirektionale Bindung zwischen String -Eigenschaft und IntegerProperty

Map<Integer, String> m = ...;
StringProperty sp = ...;
IntegerProperty ip = ...;

Bindings.bindBidirectional(sp, ip, new StringConverter<Number>() {

    @Override
    public Integer fromString(String s) {
        for(Integer key: m.keySet()) {
            if(m.get(key).equals(s)) {
                return key;
            }
        }
        return -1; // or whatever makes sense for you
    }

    @Override
    public String toString(Integer i) {
        return m.get(i);
    }
});
nabil