Permlink Replies: 0 - Pages: 1 Threads: [ Previous | Next ]
JeffTucker

Posts: 8,039
Registered: 31-Jan-2006
Theme image sizes in compiled UI
Posted: 18 Nov 17, 21:43
  Click to reply to this thread Reply
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()
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums