// get textFont value from model
map.put(TextAttribute.FAMILY, itModel.getFontName());
// get text height value from model
map.put(TextAttribute.SIZE, new Float(itModel.getFontSize()));
// make a new attributed string
attStr = new AttributedString(itModel.getText(), map);
// listen for ImageTools Model to update fontName
itModel.pcs.addPropertyChangeListener("fontName", new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent propertyChangeEvent) {
// update map
map.put(TextAttribute.FAMILY, itModel.getFontName());
// make a new attributed string
attStr = new AttributedString(itModel.getText(), map);
}
});
// listen for ImageTools Model to update fontSize
itModel.pcs.addPropertyChangeListener("fontSize", new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent propertyChangeEvent) {
// update map
map.put(TextAttribute.SIZE, itModel.getFontSize());
// make a new attributed string
attStr = new AttributedString(itModel.getText(), map);
}
});
// listen for ImageTools Model to update text
itModel.pcs.addPropertyChangeListener("text", new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent propertyChangeEvent) {
// make a new attributed string
attStr = new AttributedString(itModel.getText(), map);
}
});
} // end constructor