Something I spent a frustrating half-hour learning, and thought I'd pass along, in the hopes of sparing someone else the agony.
Let's say you've got a couple of JSpinner()'s in your UI for theme image height and width. Now, you want to monitor those, and on any change, alter the theme image dimensions in the engine. Some code that will help:
new StateMonitor() {
public void onChange() {
folderImageSize.setText(themeImageWidth.getValue().toString() + "x" + themeImageHeight.getValue().toString());
engine.setThemeImageDim(new Dimension((int)themeImageWidth.getValue(), (int)themeImageHeight.getValue()));
}
}.add(themeImageHeight).add(themeImageWidth).done();
Maybe some of that is overkill, but I found that without the various
get's and
to's, I was getting truly bizarre outcomes.
I'll post back if I discover that there's
still something crazy happening.
Edit: BTW, NetBeans caught most of the problems, but not one of them, and that one was the killer. It didn't complain about
this, which yields nothing but misery:
themeImageWidth.toString()