Lemur resize border

was quite simple to change to CursorListener!
the resizable panel is finally working, but still has some issues…

That would require a new state.update() to check the position of the mouse thru the app object,


in an screen region that have no listeners at all (in case I could depend on them in some way?),

is that what you mean?

When you press a mouse/cursor button down in something that receives events. When you SET CONSUMED on the event… you will continue to get mouse moved or cursor moved events to that original listener forever and ever and ever until the user releases the mouse button they clicked. No special tricks needed.

This is why the sliders still move up and down when the mouse is not over them. They are “captured” until the mouse button has been released.

1 Like

so I think I was able to create a BuggyBehavior:

as you can see:

  1. behind the ResizablePanel there is a ListBox, with a selected item (this is the 1st animation frame!).
  2. I click the ResizablePanel bottom border to drag it
  3. fastly moving downwards, I release the mouse button, but what happens now is:
    3.a) the resizing happens with the mouse cursor outside the ResizablePanel
    3.b) the mouse button is released outside the ResizablePanel (because I was moving faster then it could be resized
    3.c) the mouse button UP event is consumed by the ListBox behind it, so its item in the middle gets selected!
  4. I further move the mouse cursor upwards. The CursorListener.cursorMoved() will continue receiving events, so my code will continue dragging it shrinking the window vertically (with the mouse button already released).

but, it is fully working now:

  • we can resize the window as fast as we want,
  • the drag hook will not be lost
  • the minimum sizes constraint will break the drag hook for safety
  • a direct LWJGL “mouse button not pressed” verification will break the drag hook, preventing further ResizablePanel resizing from the BuggyBehavior

So basically, the only remaining problem is the mouse cursor UP event is still sent to the ListBox, or anything else that could be behind the ResizablePanel.

…what do you mean by “break the drag hook”?

As to your other issue, the captured component should always receive the UP event first… if it doesn’t consume it then something else might also and then I guess the capture is not broken.

Bottom line: if you consume events and want to keep them then you need to mark them consumed. Else they are up for grabs for other things to process.

1 Like

thx!! your latest tips fixed it all!

  • it is working perfectly now, similar to any window manager border resizer out there!
  • removed the LWJGL check (of course).

The drag hook in a sense that the mouse is not at the border or corner while it still can resize the panel as long the button is pressed. Breaking it was to stop/end the dragging functionality. But with your latest tips, that functionality is only ended when the button is released, so no need to call it anywhere else.

EDIT: I just thought, instead of a ResizablePanel, it could be something that improves the existing Panel optionally, so I could use it with a Container or anything else, not sure if possible yet tho…

I wrapper panel is still probably the easiest/safest/clearest way.

In theory, you could so it in a special GuiComponent implementation.

Even still, the separate ResizablePanel thing is nice because it makes it easier to style the border and have that apply to all resizable windows in your UI.

A GuiComponent implementation could be added to GUI elements with styling… which seems cool at first until you think about the cases where it’s added accidentally and suddenly users can resize buttons and labels and stuff. :slight_smile: Plus, it ends up being a wrapper for some other component that will actually draw the border.

1 Like

just implemented it, was so fast! just applied to my developer console main Container and it promptly worked great (after all few required setups, min size basically)!
EDIT:(I broke the link as it is deprecated, still there if someone is curious tho) github.com/AquariusPower/Lemur/blob/775508636960ef3785cdb54491deb525fef97e61/src/main/java/com/simsilica/lemur/PanelResizableEnhancer .java

you mean thru the risazable identifier when applying the style right? couldnt that flow to the PanelResizableEnhancer instead, like it could listen to that request?

GuiComponent implementation? still need to learn more about it.

I don’t know why it needs to be so complicated, though.

new ResizablePanel(myRealPanel);

…seems pretty straight-forward to use and implement. What are the down sides?

1 Like

the problem was that I actually needed it on a top level Container :slight_smile:

new ResiablePanel(myContainer);

I still don’t understand the issue.

1 Like


lol… I was in a hurry to go sleep and spent more time doing the wrong thing, thx! :smiley:
I think the basic is complete then :slight_smile:

is there some way to truncate the text displayed on the BitmapText of the buttons (items) at the ListBox thru Lemur?

Otherwise I would just have to find them thru JME node childs, and
.setLineWrapMode(LineWrapMode.NoWrap) (EDIT.: NOT Clip, my bad)
but I dont know if that could break something?

the overlapping happens when I shrink the panel too much. No problem on shrinking too much other than the overlapping button’s text I mean.

EdIT: btw, I ran the Lemur demos (quite cool) (added some project files for eclipse), and found no answer to that.

I guess there isn’t an easy way to access the clip mode of the underlying BitmapText. Note: it’s a character by character clip but would still do what you want, I guess.

Regarding that, it’s probably not a bad idea to add the eclipse and idea plugins to the build.gradle… would save folks who use IDEs some trouble, I guess.

1 Like

my bad, was .NoWrap, and worked fine every time I update ListBox.setVisibleItems()!

private void recursivelyApplyNoWrap(Node nodeParent) {
	for(Spatial spt:nodeParent.getChildren()){
		if(spt instanceof BitmapText){
		if(spt instanceof Node){

Would be cool, took me a few mins to configure the whole project to run on eclipse, but I was too curious to see the demo :slight_smile:
I will stick with eclipse Luna as it runs quite fast on my machine and I am quite used to it (to its minor problems too).