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

Posts: 7,682
Registered: 31-Jan-2006
Theme image sizes in compiled UI
Posted: 18-Nov-2017 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()));
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:
Forum admins
Helpful Answer
Correct Answer

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