Skip to content

Button of clearable TextField not shown #1351

@goldfischli

Description

@goldfischli

Normally the clearable TextField shows the x-button as long as it contains any text.

However, if the text is changed in rapid succession the closeable TextField can lose track and hide the x-button even if the TextField is not empty.

Here is an example demonstrating the issue:
(the Button toggles the x-button, the textField remains non-empty)

package com.onexip.wago.cleverscript.sheets.datalink;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.TextField;
import javafx.scene.layout.HBox;
import javafx.stage.Stage;
import org.controlsfx.control.textfield.TextFields;

public class ClearableTextfield extends Application
{
    @Override
    public void start(Stage stage) throws Exception
    {
        TextField textField = TextFields.createClearableTextField();
        textField.setText("Hello");

        Button button = new Button("Test");
        button.setOnAction(e -> {
            textField.setText("");
            textField.setText("There!");
        });

        stage.setScene(new Scene(new HBox(textField, button)));
        stage.show();
    }

    public static void main(String[] args)
    {
        launch(args);
    }
}

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions