(May 2022) Monthly WIP Screenshot Thread

Cool. Glad you got it working.

Isn’t the switch/case redundant if you will just be doing instanceof checks anyway? There is no real magic with a string-based switch-case… it’s just doing a series of if/elseif/elseif/elseif anyway.

I will rethink that. But the instance check alone wont (did not) work. As the “normal” ListBox items are Buttons. In case you want to display a picture (Button with Background) you cant differentiate and the “value” will be a Button and not a String.
Not sure if the instance check is necessary then.
But the least effort went to the CellRenderer most of the “invested” time went into refactoring and adjusting the Listbox class (e.g. setting rowheights was not yet available)

As written, unless you have another Button class that is not the regular Lemur Button then the result is the same either way… and if you DO have your own Button class then you could always put that instanceof check first in the elseif chain.

…and if value is a string then it won’t pass any of those instance checks.

(And I reiterate that it’s really weird to put UI components in your list model instead of model objects… it’s like putting ViewportPanels in your database.)

Great job @rickard . Keep it up!

3 Likes