-
Bug
-
Resolution: Unresolved
-
P4
-
jfx11, jfx20, jfx17, jfx19
-
generic
-
generic
A DESCRIPTION OF THE PROBLEM :
The promptText for the comboBox is displayed only on load. When a value is selected and cleared, the prompt text is not displayed. This used to work in JavaFX 8.
REGRESSION : Last worked in version 8
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Set promptText to a comboBox which has no value by default.
2. Select an option from the comboBox. The promptText is removed and a value is displayed.
3. Clear the value of the comboBox. (using some external call)
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The promptText should be displayed in the ComboBox.
ACTUAL -
The promptText is NOT displayed in the ComboBox.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class ComboBoxPromptTextIssue extends Application {
@Override
public void start(Stage primaryStage) {
ComboBox<String> comboBox = new ComboBox<>();
comboBox.setPromptText("Select Value");
comboBox.getItems().addAll("One", "Two", "Three", "Four");
Button clear = new Button("Clear value");
clear.setOnAction(e->comboBox.setValue(null));
VBox root = new VBox(comboBox,clear);
root.setAlignment(Pos.CENTER);
root.setSpacing(20);
Scene scene = new Scene(root, 300, 200);
primaryStage.setTitle("ComboBox FX " + System.getProperty("javafx.runtime.version"));
primaryStage.setScene(scene);
primaryStage.show();
}
}
---------- END SOURCE ----------
FREQUENCY : always
The promptText for the comboBox is displayed only on load. When a value is selected and cleared, the prompt text is not displayed. This used to work in JavaFX 8.
REGRESSION : Last worked in version 8
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Set promptText to a comboBox which has no value by default.
2. Select an option from the comboBox. The promptText is removed and a value is displayed.
3. Clear the value of the comboBox. (using some external call)
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The promptText should be displayed in the ComboBox.
ACTUAL -
The promptText is NOT displayed in the ComboBox.
---------- BEGIN SOURCE ----------
import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
public class ComboBoxPromptTextIssue extends Application {
@Override
public void start(Stage primaryStage) {
ComboBox<String> comboBox = new ComboBox<>();
comboBox.setPromptText("Select Value");
comboBox.getItems().addAll("One", "Two", "Three", "Four");
Button clear = new Button("Clear value");
clear.setOnAction(e->comboBox.setValue(null));
VBox root = new VBox(comboBox,clear);
root.setAlignment(Pos.CENTER);
root.setSpacing(20);
Scene scene = new Scene(root, 300, 200);
primaryStage.setTitle("ComboBox FX " + System.getProperty("javafx.runtime.version"));
primaryStage.setScene(scene);
primaryStage.show();
}
}
---------- END SOURCE ----------
FREQUENCY : always