[SOLVED] Cursor disappears at low resolution in TextField


#1

If I run the app with screen resolution 640*480 cursor disappears if TextField is empty and some times while writing :

but works fine if I run with resolution 800*600 or larger

Here is the test code:

public class TestTextField extends SimpleApplication {

    public TestTextField() {
        
    }

    public static void main(String[] args) {
        TestTextField main = new TestTextField();
        AppSettings settings = new AppSettings(true);
        settings.setRenderer(AppSettings.LWJGL_OPENGL3);
        settings.setGammaCorrection(false);
        settings.setVSync(true);
        main.setSettings(settings);
        //main.setShowSettings(false);
        main.start();
    }

    @Override
    public void simpleInitApp() {
        GuiGlobals.initialize(this);
        BaseStyles.loadGlassStyle();
        GuiGlobals.getInstance().getStyles().setDefaultStyle("glass");

        Container container = new Container();
        
        container.addChild(new Label("Model:"));
        TextField modelInfoField = container.addChild(new TextField(""));
        modelInfoField.setSingleLine(true);
        modelInfoField.setPreferredWidth(cam.getWidth() / 2);
        //container.addChild(new Button("Paste Clipboard")).addClickCommands(new PasteClipboardCommand(modelInfoField));
        
        container.addChild(new Label("Path:"));
        TextField pathField = container.addChild(new TextField(""));
        pathField.setSingleLine(true);
        pathField.setPreferredWidth(cam.getWidth() / 2);
        //container.addChild(new Button("Paste Clipboard")).addClickCommands(new PasteClipboardCommand(pathField));
        
        guiNode.attachChild(container);
        GuiManager.setPosition(container, GuiManager.Position.CENTER, cam);
    }
}

Edit:
I am using Lemur 1.12.0.


#2

I noticed this only happens when I set

textField.setPreferredWidth()

#3

Oops, I just notice there is a new method setPreferredCursorWidth() added in Lemur 1.12.0 to override cursor width. I set width to 2 and my problem solved :slightly_smiling_face:


#4

Yeah, this phenomenon is totally bizarre. I never did figure out why it happens.