Lemur textfield invisible?

I have the strange phenomenon, that textfields are invisible (but still require space)

There should be 2 TextFields between the two buttons

Do I have an error in the way I do the layouting?

package de.visiongamestudios.client.loginscene;

import java.util.concurrent.Callable;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.jme3.math.Vector3f;
import com.jme3.renderer.RenderManager;
import com.jme3.renderer.ViewPort;
import com.jme3.scene.Spatial;
import com.jme3.scene.control.Control;
import com.simsilica.lemur.Button;
import com.simsilica.lemur.Command;
import com.simsilica.lemur.Container;
import com.simsilica.lemur.Label;
import com.simsilica.lemur.TextField;

import de.visiongamestudios.client.Settings;
import de.visiongamestudios.client.jme.RendererApplication;

public class LoginUi extends Container implements Control, InitializingBean {

	private static final float	SIZE_X	= 500;

	private static final float	SIZE_Y	= 500;

	RendererApplication			app;

	private TextField			password;
	private TextField			username;
	private Label				status;
	private Button				login;
	private Button				devlogin;

	public LoginUi(LoginScene loginScene) {
		status = new Label("server status");
		login = new Button("Login");
		devlogin = new Button("devLogin");

		Settings settings = Settings.getInstance();

		username = new TextField(settings.getUsername());
		password = new TextField(settings.getPassword());


		login.addClickCommands(new Command<Button>() {

			public void execute(Button source) {


		devlogin.addClickCommands(new Command<Button>() {

			public void execute(Button source) {


	public String getUserName() {
		return username.getText();

	public String getPassword() {
		return password.getText();

	public void setStatus(String string) {

	public Control cloneForSpatial(Spatial spatial) {
		return null;

	public void setSpatial(Spatial spatial) {

	public void update(float tpf) {
		setPreferredSize(new Vector3f(SIZE_X, SIZE_Y, 1));
		setLocalTranslation(app.getActualDisplayWidth() / 2 - SIZE_X / 2, app.getActualDisplayHeight() / 2 + SIZE_Y / 2, 0);

	public void render(RenderManager rm, ViewPort vp) {

	public void afterPropertiesSet() throws Exception {
		app.enqueue(new Callable<Void>() {

			public Void call() throws Exception {
				return null;


Something is definitely wrong and it seems strange because your setup is pretty straight forward. If you click in those spaces does it let you type?

It does not seem like that (or the rest is invisible as well)
I’m currently using the git master from yesterday, if that is of relevance.

I will take a look at this tonight. Sometimes I can eke out a bit of time during day job but today things dumped in my lap that will prevent that.

Curious: Does it do it if you don’t force the size of the window?

Hah :wink: I know that feeling all to well :slight_smile:

Yes it does:

And another random question… are the values you are passing to the TextFields nulls or empty strings or actual values? Like, what is settings.getUsername().

it should currently be “empire” but it might be null to any string, can the box not handle null? (I have no exception)

I don’t know if it can’t handle null… if so it’s a bug. But that’s why I asked. :slight_smile:
…trying to trouble shoot without the time to actual test it.

Don’t worry I only have time to develop further in between compile pauses (20 min + :frowning: ) and similar XD :slight_smile:

I now forced non null values and they appear to work somewhat now:

(Note I removed the prefered size for the ui, and instead just give the statuslabel a prefered size,so the rest layouts itself, looks way better in my opinion.)

The text no appears correctly and it is editable.
However I see no cursor (if there even is one) and no border.

Do you maybee have somewhere a picture/application which contains a textfield with the default groovy based styling, so that I can compare where things go different?

I was about to point you to… then I reealized, no. I guess I don’t have a public app that uses text field.

I’ll try to put together a demo. It could just be that the glass style doesn’t have text fields setup properly.

Thanks for doing all the digging so far.

I figured out what the issue is with the missing cursor. As soon as I tried to have a text field in my glass style I saw the same issue. I actually don’t know why I don’t have the problem with other styles but anyway…

The issue is that BitmapText by default has an alpha of -1 (indicating that no special alpha has been set). TextEntryComponent inside Lemur grabs the alpha of the BitmapText (along with the color) to set the color of the cursor. The fix is easy as I now just detect that and set cursor alpha to 1.

Longer term, the cursor parameters should probably by stylable properties and this wouldn’t be an issue because then cursor alpha would be tracked with cursor color.

Until I make a 1.8.2 release, you might be able to work around it by making sure your text colors have alpha. (Or really all of your components if you set the alpha on the root panel.)

Maybe I don’t hit it because my panels with edit fields are fade-animated. (shrug)

1 Like

Yay, I wil sit this out :stuck_out_tongue: Enough other stuff to do with lxml parser :slight_smile:

I have ran into this issue with the textfield having focus and cursor not showing.

I find that if I have a period as the second char (0. for example), after typing the third char (0.0), the cursor will disappear and then reappear on the 4th char.

If the third char is a period (00.) then the cursor will disappear as soon as the period is typed, reappearing on 4th char again.

Using a standard, no frills textfield or any for that matter.

Edit: Doesn’t do it when broken out into a test so I must of screwed up something somewhere. Never Mind…

If your no frills test was using a different font then make sure your font is ok. Maybe it has some really weird offset for the ‘.’ character or something.

Tracked it down to this.

        //Set the default font size
        attrs = styles.getSelector("glass");
        attrs.set("fontSize", 12);

Does it in the test now.

Unsettling the preferred width shifts it by 1 to fourth char.

package mygame;

import com.jme3.app.SimpleApplication;
import com.jme3.renderer.RenderManager;
import com.jme3.system.AppSettings;
import com.simsilica.lemur.Container;
import com.simsilica.lemur.GuiGlobals;
import com.simsilica.lemur.Label;
import com.simsilica.lemur.Panel;
import com.simsilica.lemur.TextField;
import com.simsilica.lemur.style.Attributes;
import com.simsilica.lemur.style.BaseStyles;
import com.simsilica.lemur.style.Styles;

public class Main extends SimpleApplication {

    public static void main(String[] args) {
        Main app = new Main();
        AppSettings settings = new AppSettings(true);
        settings.setTitle("Test Disappearing Cursor");

    public void simpleInitApp() {
        //Set the default font size
        Styles styles = GuiGlobals.getInstance().getStyles();
        Attributes attrs = styles.getSelector("glass");
        attrs.set("fontSize", 12);
        Container cont = new Container();
        cont.addChild(new Label("Click textfield and enter a character:"));
        TextField fieldNoCursor = cont.addChild(new TextField("0."));
     * Centers any lemur component to the middle of the screen.
     * @param cont the lemur component to center.
    public void centerComp(Panel cont) {
        // Position the panel                                                            
        cont.setLocalTranslation((getCamera().getWidth() - cont.getPreferredSize().x)/2, 
                (getCamera().getHeight() + cont.getPreferredSize().y)/2, 0);

    public void simpleUpdate(float tpf) {
        //TODO: add update code

    public void simpleRender(RenderManager rm) {
        //TODO: add render code

I ran a different font and same results except when the font disappears shifts slightly.

At size 13 or larger it seems ok but I am not sure as it may just be pushed off further before it happens.

Another mystery for me is how you get your font to be so crisp and clear. Mine all suck at any dimension when using the sdk to build them.

Edit: GuiGlobals shows its the default font.
Edit: Ran it with Console.fnt and same results. Worse actually, even letter and numbers, any size, cause it to happen and it happens frequently.

Does this happen for you with any of the Lemur demos?


I ran it like so, SimpleApplication,

        //Set the default font size
        Styles styles = GuiGlobals.getInstance().getStyles();
        Attributes attrs = styles.getSelector("glass");
        attrs.set("fontSize", 12);
        stateManager.attach(new TextEntryDemoState());

Then just droped the TextEntryDemoState into my src and ran.

Which version of JME are you running?

I just think it’s weird that 12 seems to be some kind of hinge point. There was a commit someone did to ‘fix’ BitmapText to only draw on full units that I had reverted (99% sure) or never merged because it would have way broken bitmap text. But things like this make me think of that.