Gui - TextArea

What would be the best gui that has a good TextField that has scroll bars.

I’m writing a text adventure game and need a good text field that just keep adding text to that will keep scrolling so user can see their history.


Like a ListBox and a Textfield for entering text?

I’m only using 2 fields.

A single line for text input.

Another box that i can dump the text output. Like a TextArea, with scrolling for history, like a word processor or JTextArea with a JScrollPane.

The TextArea is NO USER INPUT, just output from the game.

It is weird to use JME for this, this is more of a test thing for me.


Lemur’s TextField can be put into multiline mode:

It’s probably going to be unsatisfying as it doesn’t have a scroll bar (general scroll bars are hard in JME).

When I have these cases, I use a ListBox and just add new lines to the model and scroll down.

That is what I was finding out.

Is there anyway to make the fields “disabled”, not allowing user input. It is a read only field, basically.

Well, about scroll, there is always easy way to achieve it.

CreatePostView viewport and render all long text in parallel view, and just move camera up/down as scroll using Lemur or any GUI scrolls.

So far myself i have element scrolling, but i think i will need add scrolling like this in future anyway.

Yes. I’ve done this with other game. I render it to all a buffer than attach that texture to the gui. it works great.

I was hoping to see if JME has a GUI that has this support already. If I’m missing a gui library, I have not located a gui library that does a good amount of implementation.

I’ve ended up creating my own GUI system, but was looking to check out JME library if they have one.

well myself i also re-invented wheel, i were young and stupid, just because i didnt knew Lemur can be rendered in 3d world/elements too, but it is possible so i did wrong.

But ye, its odd that Lemur do not have Scrolls like this implemented already.

Well at least now its easy for me to make non standard solutions.

Just now i were making text pre-rendered using TTF with icons/tooltip-info, so for me scroll like that would be zero problem to make rly.

But it do not matter what GUI lib using here rly, if can pass proper cursor position(if you even need functionality inside offscreen renderer), then all is fine, just need offscreen renderer. Gui lib only need provide scroller element that need use.

Both toneGodGUI and jme3-niftygui provide scroll bars.

nifty gui, by nature of hooking directly into JME’s rendering has access to set the clip rectangle. That’s the only way to do it right but then you can’t just be “regular scene graph spatials” anymore.

No one has solved the “clipping from a spatial” problem yet.

Viewports are a substandard mechanism for general purpose use because they impose a hundred restrictions on how GUI components interact with one another. It’s fine if the GUI component is the only modal thing on the screen and completely falls apart when you have two scroll panels that overlap.

Edit: and you can use Lemur with viewports which seems to be way easier than rolling a whole new GUI library just to get that. Providing a general solution built into Lemur is “hard” ™.

1 Like

Yes. didn’t think there was a great solution.

It is to bad that JME doesn’t support glScissor(). It could be used inside a “Node” to limit drawing outside of the clip area.

I’ve used this technique for my own engine. Works great, each Gui has the ability to turn on clipping.

For JME, I just render to a buffer for the scroll area, that supports any “Node” and then clip it based on the node visible area. I don’t like that idea, maybe better ways than the way I’m handling it, because I do an offscreen buffer and then attach that texture to guiNode and allow JME to renderer that texture.

1 Like

Tricky part #1: a Node can appear in many different viewports at the same time.
Tricky part #2: a Node can appear in a 3D view… glScissor() might handle this case but the simple cliprect stuff that nifty uses wouldn’t.
Tricky part #3: the scene graph hierarchy is unavailable by the time the Geomtry is rendered so somehow the clip/scissor areas need to be combined all down the hierarchy so that a particular Geometry has an accurate clip/scissor shape.

Someone tried to add clip rectangles to the scene graph once but neglected to handle a bunch of common use-cases. (And clip rect won’t even work in 3D.)


stencil buffer might do the trick

@pspeed Yes, I understand that it would be different to make sure it works without major side effects. That is why I ended up just rendering to a buffer and displaying that buffer.

I still like this way, it allow cool things to do.

Who will guess based on what game this example is similar? :slight_smile:
And its just buffer rendered gui used on Sphere for nice effect.

1 Like

That is what I’ve done for some of my UIs also. JME makes it difficult to do this in a general way that doesn’t require the user of the UI library to setup a bunch of stuff externally.

I have considered having an off-screen buffer “atlas”, though.

“Render to buffer” is the most flexible way and supports all kinds of stuff. I used it to render my UIs on the curved pages of a book.

1 Like

This is what I find the best option also.

I have a question though, since you render to a buffer.

What I do is create a unique scene for the buffer and call


inside of simpleUpdate.

What is the best way so I can use this as a library and the library handles this. Is there a way. To not require used to not forget to put that in the simpleUpdate function of application?

Put your code in an app state that the user would attach to get the functionality. Then they don’t have to remember what to create, what to call when, etc… as the app state would handle all of that. Creating the camera, buffer, viewport, root node, whatever.

For the book interface for (the unreleased) second Mythruna engine, I had an off screen buffer that represented four different pages and I’d position page UIs in one quadrant. (This was to support normal two page view as well as the sides of the page that was turning.)

The code that needed to render it would ask the app state for the texture. The code that needed to add a UI to a page would call the app state to set the Lemur Panel for a particular quadrant.

1 Like

Thats for the idea. I like that and i will do that. It will make it easier for carrying over to another project.

I have 5 project a that share this library and it would make it easier and safer.

1 Like

I have another question. I’m trying ToneGodGui.

I’m using TextField. Everytime “public void onKeyPress()” gets called. It gets called twice. First one is a “SPACE” and then the character you hit on the keyboard.

Not sure what is happening, does anyone have a clue?

1 Like