Dropdown with lemur


How i create a dropdown compent in lemur


Until lemur gets an official version, you have to roll your own by combining a few existing things:


i don´t know how combine to make a dropdown component can you make a simple example


If I had time to make a simple example then I’d have added a combo box to Lemur already.

Lemur is a great framework for developing your own GUI elements and it happens to include a bunch of default ones. But when something is missing, it’s kind of up to you to develop what you need on top of what’s provided.

Unfortunately, that means that developers who are still relatively new to Java, etc. may struggle until I get more time to work on those specific elements.


ok thanks
i not reality new in java
i never pogramming with jmonkey
I usually use the swing to make my app


I recently switched from swing to Lemur, it is not a large leap. I also needed a drop down, but have just used a list for now, and will either move to a drop down when it is released, or roll my own in a few weeks. Don’t let not having a drop down for now be a road block :wink:


I took a button as my drop down head. When I click that button I create a list right below that button. that’s it basically of course there was s a bit more than that for example to remove to drop down list when you click something and so on. but it is doable.


And if you put the list in the PopupState then it will automatically close if the user clicks outside of the list.


To create a dropdwon i have to create a class like this

 public class dropdown extends Panel {

private Button click

    private Panel  range;

    private TextField text;
private ListBox



I created a modified version of Lemur a while ago that contains a drop down menu, you can grab the whole package from my Google Drive: https://drive.google.com/open?id=0B6BscJ4Cq-K7ZUlJakxKZFRiTGs

Check out src/com/simsilica/lemur/DropDown.java




Cool, but why not also make a PR?


A public relations?


He means a pull request to the lemur (proto) repository. First fork it then commit your changes and create a request.


Are you the guy who didn’t like github for some reasons or am I wrong? (Not meant to be offensive)


I don’t think I’m the guy that didn’t like github for some reason. Aside from downloading some open source stuff I’ve barely ever used github. I’m not a professional programmer, just a dude with little to do other than horse around with an old laptop.

I don’t know how to fork a project on github and while I’m sure I could figure it out I don’t really see any reason to for this particular project. Paul doesn’t seem particularly interested in using any of my code in Lemur and I can’t say that I blame him. First of all, I’m not exactly classically trained so my code might be less readable to someone expecting something to follow guidelines that I never learned. Secondly I can be a bit of a here today gone tomorrow type of guy, I don’t really have any obligations to anyone or anything and I’m sure Paul doesn’t want to end up having to manage a whole heap of new code because I’m not around to do so myself.

P.S. I’m a little bored so I’ve been throwing around the idea of writing a new game or application or, I don’t know, something so I dropped by the forum the other day and happened by this thread, thought I’d drop a line.


Contributing to an open source project can be a pretty daunting gauntlet to run through. I don’t blame anyone for skipping it if they’ve already developed something that “works for them” and they don’t want to have someone else “pick on it” while molding it into contributable form.

That being said, these days the parts are already in Lemur for pretty easily making a drop down. So it’s reasonable that someone might contribute one before I get the couple hours + proper motivation to make one myself.

Edit: it’s also unclear if OP means a drop down menu (trivial) or a combo box style GUI element (less trivial).


I don’t think it’s an issue of being daunting or that my version of Lemur only “works for me,” but that what I’ve added doesn’t seem particularly compatible with your vision for Lemur so I don’t see a need to fork it and create a pull request when you’re likely to reject the changes.

My drop down menu and combo box both use the VBoxLayout and HBoxLayout that I created, which, in an earlier discussion you indicated that you felt those two layouts didn’t have any use cases. Moreover my version includes a “double dip” method of laying out elements that ensures proper space is allocated for elements in which the aspect ratio might change when the width or height is modified in the first layout pass. You indicated in an earlier discussion that you would not be particularly enamored with this extra step.

Additionally this package includes GradientBackgroundComponents which allow rounded corners and gradients to be specified at runtime and if I recall you said you didn’t want any “hacks” such as this in Lemur.


I don’t recall what the hack is. I have tried to keep Lemur working with only the stock JME shaders, though. It makes it easier for folks (like yourself) to swap them with their own because behavior is well defined and consistent.

And yes, the double dipping layout concerns me because on paper I can create situations where it needs to be a triple dipping layout and then a quadruple dipping layout. So to me it isn’t to “double dip or not” but to “go full on iterative layouts” and bring with that all of the complexity.

I’m super glad it works well in all of your use-cases, though. And that’s the benefit of open source.

So, yes, if your drop down is tied to all of that then it’s probably more work to make it “core friendly” than it’s worth.

Still not sure if OP means a drop down menu or a combo box, though. One is 5 lines of code and the other is a bit more complicated.


Indeed why I’m not creating a pull request.


Besides, it actually makes me happy that people create such cool add ons or extensions. The visuals for your stuff always look really great. I wouldn’t want to, nor should I, impede that in any way. In fact, I encourage it.

It’s through a thriving ecosystem that progress will be made. Your stuff is always in my peripheral view and it’s bound to inspire and influence where Lemur goes in the future in some way.